Class TrainCommon
- java.lang.Object
-
- jmri.jmrit.operations.trains.trainbuilder.TrainCommon
-
- Direct Known Subclasses:
HtmlTrainCommon,JsonManifest,PrintShowCarsInTrain,Router,TrainBuilderBase,TrainCsvCommon,TrainManifest,TrainPrintBuildReport,TrainPrintManifest,TrainSwitchLists
public class TrainCommon extends java.lang.Object
Common routines for trains
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean_dropCarsprotected boolean_pickupCars(package private) boolean_printLocalMoveHeader(package private) boolean_printPickupHeader(package private) boolean_printSetoutHeaderstatic java.lang.StringBLANK_LINEprotected static java.lang.StringBUILD_REPORT_CHARprotected CarManagercarManager(package private) java.util.List<Car>doneCarsprotected static booleanENGINEprotected EngineManagerengineManagerprotected static charHORIZONTAL_LINE_CHARstatic java.lang.StringHYPHEN(package private) intindexprotected static booleanIS_MANIFESTstatic booleanIS_TWO_COLUMN_TRACKstatic booleanLOCALprotected LocationManagerlocationManagerprotected static java.lang.StringNEW_LINEprotected static java.awt.DimensionPAPER_MARGINSprotected static booleanPICKUPstatic java.lang.StringSPACEprotected static java.lang.StringTABprotected static java.lang.StringTEXT_COLOR_DONEprotected static java.lang.StringTEXT_COLOR_ENDprotected static java.lang.StringTEXT_COLOR_START(package private) java.util.List<java.lang.String>utilityCarTypesprotected static charVERTICAL_LINE_CHAR
-
Constructor Summary
Constructors Constructor Description TrainCommon()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddCarsLocationUnknown(java.io.PrintWriter file, boolean isManifest)protected voidaddLine(java.io.PrintWriter file, java.lang.String string)Writes string to file.static voidaddLine(java.io.PrintWriter file, java.lang.String level, java.lang.String string)Writes a line to the build report fileprotected voidblockCarsByTrack(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)Block cars by track, then pick up and set out for each location in a train's route.protected voidblockCarsByTrackNameTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)Produces a two column format for car pick ups and set outs.protected voidblockCarsTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)Produces a two column format for car pick ups and set outs.protected voidblockLocosTwoColumn(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)Used to generate "Two Column" format for engines.voidclearUtilityCarTypes()protected intconvertStringTime(java.lang.String time)static java.util.DateconvertStringToDate(java.lang.String date)intcountPickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest)intcountSetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)protected intcountUtilityCars(java.lang.String[] format, java.util.List<Car> carList, Car car, boolean isPickup)Scans the car list for utility cars that have the same attributes as the car provided.static java.lang.StringcreateTabIfNeeded(int tabSize)Creates a String of spaces to create a tab for text.protected voiddropCar(java.io.PrintWriter file, Car car, boolean isManifest)Adds the car's set out string to the output file using the manifest or switch list formatjava.lang.StringdropCar(Car car, boolean isManifest, boolean isTwoColumnTrack)Returns the drop car string.java.lang.StringdropEngine(Engine engine)Returns the drop string for a loco.protected voiddropEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)Adds a list of locomotive drops for the route location to the output file.static java.lang.StringformatColorString(java.lang.String text, java.awt.Color color)Adds HTML like color text control characters around a string.static java.lang.StringformatStringToCommaSeparated(java.lang.String[] array)Produces a string using commas and spaces between the strings provided in the array.static java.lang.StringgetDate(boolean isModelYear)static java.lang.StringgetDate(java.util.Date date)java.lang.StringgetDropCarHeader(boolean isManifest, boolean isTwoColumnTrack)java.lang.StringgetDropEngineHeader()static java.lang.StringgetISO8601Date(boolean isModelYear)static intgetLineLength(boolean isManifest)Returns the line length for manifest or switch list printout.java.lang.StringgetLocalMoveHeader(boolean isManifest)static intgetManifestHeaderLineLength()protected static java.awt.DimensiongetPageSize(java.lang.String orientation)java.lang.StringgetPickupCarHeader(boolean isManifest, boolean isTwoColumnTrack)java.lang.StringgetPickupEngineHeader()static java.lang.StringgetSwitchListTrainStatus(Train train, RouteLocation rl)static java.awt.ColorgetTextColor(java.lang.String string)static java.lang.StringgetTextColorName(java.lang.String string)static java.lang.StringgetTextColorString(java.lang.String string)Removes the color text control characters around the desired stringstatic java.lang.StringgetTrainMessage(Train train, RouteLocation rl)static booleanisNextCar(Car car, RouteLocation rl, RouteLocation rld)Used to determine if car is the next to be processed when producing Manifests or Switch Lists.static booleanisNextCar(Car car, RouteLocation rl, RouteLocation rld, boolean isIgnoreTrack)protected booleanisThereWorkAtLocation(java.util.List<Car> carList, java.util.List<Engine> engList, RouteLocation rl)static booleanisThereWorkAtLocation(Train train, Location location)returns true if the train has work at the locationjava.lang.StringlocalMoveCar(Car car, boolean isManifest)Returns the move car string.protected voidnewLine(java.io.PrintWriter file)Adds a blank line to the file.protected voidnewLine(java.io.PrintWriter file, java.lang.String string, boolean isManifest)Writes a string to a file.static java.lang.StringpadAndTruncate(java.lang.String s, int fieldSize)static java.lang.StringpadAndTruncateIfNeeded(java.lang.String s, int fieldSize)Pads out a string by adding spaces to the end of the string, and will remove characters from the end of the string if the string exceeds the field size.static java.lang.StringpadString(java.lang.String s, int fieldSize)Adjusts string to be a certain number of characters by adding spaces to the end of the string.java.lang.StringpickupCar(Car car, boolean isManifest, boolean isTwoColumnTrack)Returns the pick up car string.protected voidpickUpCar(java.io.PrintWriter file, Car car, boolean isManifest)Adds the car's pick up string to the output file using the manifest or switch list formatprotected voidpickUpCarTruncated(java.io.PrintWriter file, Car car, boolean isManifest)Adds the car's pick up string to the output file using the truncated manifest formatjava.lang.StringpickupEngine(Engine engine)Returns the pick up string for a loco.protected voidpickupEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)Adds a list of locomotive pick ups for the route location to the output file.protected voidpickupUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)Add a list of utility cars scheduled for pick up from the route location to the output file.java.lang.StringpickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest, boolean isTwoColumnTrack)voidprintCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)Prints the two column header for cars.voidprintDropCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)voidprintDropEngineHeader(java.io.PrintWriter file, boolean isManifest)voidprintEngineHeader(java.io.PrintWriter file, boolean isManifest)Two column header format.voidprintHorizontalLine(java.io.PrintWriter file, boolean isManifest)Prints a line across the entire page.voidprintHorizontalLine(java.io.PrintWriter file, int start, int end)voidprintHorizontalLine1(java.io.PrintWriter file, boolean isManifest)voidprintHorizontalLine2(java.io.PrintWriter file, boolean isManifest)voidprintHorizontalLine3(java.io.PrintWriter file, boolean isManifest)voidprintLocalCarMoveHeader(java.io.PrintWriter file, boolean isManifest)voidprintPickupCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)voidprintPickupEngineHeader(java.io.PrintWriter file, boolean isManifest)protected voidprintTrackComments(java.io.PrintWriter file, RouteLocation rl, java.util.List<Car> carList, boolean isManifest)protected voidprintTrackNameHeader(java.io.PrintWriter file, java.lang.String trackName, boolean isManifest)protected voidsetCarPickupAndSetoutTimes(Train train, RouteLocation rl, java.util.List<Car> carList)protected voidsetoutUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)Add a list of utility cars scheduled for drop at the route location to the output file.java.lang.StringsetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)For the Conductor and Yardmaster windows.protected java.lang.StringsetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest, boolean isTwoColumnTrack)static java.lang.StringsplitString(java.lang.String name)Splits a string (example-number) as long as the second part of the string is an integer or if the first character after the hyphen is a left parenthesis "(".static java.lang.StringsplitStringLeftParenthesis(java.lang.String name)Splits a string if there's a hyphen followed by a left parenthesis "-(".protected static java.lang.StringtabString(java.lang.String s, int tabSize)protected voidtruncatedDropCar(java.io.PrintWriter file, Car car, boolean isManifest)Adds the car's set out string to the output file using the truncated manifest format.
-
-
-
Field Detail
-
TAB
protected static final java.lang.String TAB
- See Also:
- Constant Field Values
-
NEW_LINE
protected static final java.lang.String NEW_LINE
- See Also:
- Constant Field Values
-
SPACE
public static final java.lang.String SPACE
- See Also:
- Constant Field Values
-
BLANK_LINE
public static final java.lang.String BLANK_LINE
- See Also:
- Constant Field Values
-
HORIZONTAL_LINE_CHAR
protected static final char HORIZONTAL_LINE_CHAR
- See Also:
- Constant Field Values
-
BUILD_REPORT_CHAR
protected static final java.lang.String BUILD_REPORT_CHAR
- See Also:
- Constant Field Values
-
HYPHEN
public static final java.lang.String HYPHEN
- See Also:
- Constant Field Values
-
VERTICAL_LINE_CHAR
protected static final char VERTICAL_LINE_CHAR
- See Also:
- Constant Field Values
-
TEXT_COLOR_START
protected static final java.lang.String TEXT_COLOR_START
- See Also:
- Constant Field Values
-
TEXT_COLOR_DONE
protected static final java.lang.String TEXT_COLOR_DONE
- See Also:
- Constant Field Values
-
TEXT_COLOR_END
protected static final java.lang.String TEXT_COLOR_END
- See Also:
- Constant Field Values
-
PICKUP
protected static final boolean PICKUP
- See Also:
- Constant Field Values
-
IS_MANIFEST
protected static final boolean IS_MANIFEST
- See Also:
- Constant Field Values
-
LOCAL
public static final boolean LOCAL
- See Also:
- Constant Field Values
-
ENGINE
protected static final boolean ENGINE
- See Also:
- Constant Field Values
-
IS_TWO_COLUMN_TRACK
public static final boolean IS_TWO_COLUMN_TRACK
- See Also:
- Constant Field Values
-
carManager
protected CarManager carManager
-
engineManager
protected EngineManager engineManager
-
locationManager
protected LocationManager locationManager
-
_pickupCars
protected boolean _pickupCars
-
_dropCars
protected boolean _dropCars
-
_printPickupHeader
boolean _printPickupHeader
-
_printSetoutHeader
boolean _printSetoutHeader
-
_printLocalMoveHeader
boolean _printLocalMoveHeader
-
index
int index
-
utilityCarTypes
java.util.List<java.lang.String> utilityCarTypes
-
PAPER_MARGINS
protected static final java.awt.Dimension PAPER_MARGINS
-
-
Constructor Detail
-
TrainCommon
public TrainCommon()
-
-
Method Detail
-
blockLocosTwoColumn
protected void blockLocosTwoColumn(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Used to generate "Two Column" format for engines.- Parameters:
file- Manifest or Switch List FileengineList- List of engines for this train.rl- The RouteLocation being printed.isManifest- True if manifest, false if switch list.
-
pickupEngines
protected void pickupEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive pick ups for the route location to the output file. Used to generate "Standard" format.- Parameters:
file- Manifest or Switch List FileengineList- List of engines for this train.rl- The RouteLocation being printed.isManifest- True if manifest, false if switch list
-
dropEngines
protected void dropEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive drops for the route location to the output file. Used to generate "Standard" format.- Parameters:
file- Manifest or Switch List FileengineList- List of engines for this train.rl- The RouteLocation being printed.isManifest- True if manifest, false if switch list
-
pickupEngine
public java.lang.String pickupEngine(Engine engine)
Returns the pick up string for a loco. Useful for frames like the train conductor and yardmaster.- Parameters:
engine- The Engine.- Returns:
- engine pick up string
-
dropEngine
public java.lang.String dropEngine(Engine engine)
Returns the drop string for a loco. Useful for frames like the train conductor and yardmaster.- Parameters:
engine- The Engine.- Returns:
- engine drop string
-
blockCarsByTrack
protected void blockCarsByTrack(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Block cars by track, then pick up and set out for each location in a train's route. This routine is used for the "Standard" format.- Parameters:
file- Manifest or switch list Filetrain- The train being printed.carList- List of cars for this trainrl- The RouteLocation being printedprintHeader- True if new location.isManifest- True if manifest, false if switch list.
-
isNextCar
public static boolean isNextCar(Car car, RouteLocation rl, RouteLocation rld)
Used to determine if car is the next to be processed when producing Manifests or Switch Lists. Caboose or FRED is placed at end of the train unless they are also passenger cars. Passenger cars are already blocked in the car list. Passenger cars with negative block numbers are placed at the front of the train, positive numbers at the end of the train. Note that a car in train doesn't have a track assignment.- Parameters:
car- the car being testedrl- when in train's route the car is being pulledrld- the destination being tested- Returns:
- true if this car is the next one to be processed
-
isNextCar
public static boolean isNextCar(Car car, RouteLocation rl, RouteLocation rld, boolean isIgnoreTrack)
-
blockCarsTwoColumn
protected void blockCarsTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs. Sorted by track and then by blocking order. This routine is used for the "Two Column" format.- Parameters:
file- Manifest or switch list Filetrain- The traincarList- List of cars for this trainrl- The RouteLocation being printedprintHeader- True if new location.isManifest- True if manifest, false if switch list.
-
blockCarsByTrackNameTwoColumn
protected void blockCarsByTrackNameTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs. Sorted by track and then by destination. Track name in header format, track name removed from format. This routine is used to generate the "Two Column by Track" format.- Parameters:
file- Manifest or switch list Filetrain- The traincarList- List of cars for this trainrl- The RouteLocation being printedprintHeader- True if new location.isManifest- True if manifest, false if switch list.
-
printTrackComments
protected void printTrackComments(java.io.PrintWriter file, RouteLocation rl, java.util.List<Car> carList, boolean isManifest)
-
setCarPickupAndSetoutTimes
protected void setCarPickupAndSetoutTimes(Train train, RouteLocation rl, java.util.List<Car> carList)
-
getTrainMessage
public static java.lang.String getTrainMessage(Train train, RouteLocation rl)
-
getSwitchListTrainStatus
public static java.lang.String getSwitchListTrainStatus(Train train, RouteLocation rl)
-
pickUpCarTruncated
protected void pickUpCarTruncated(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the truncated manifest format- Parameters:
file- Manifest or switch list Filecar- The car being printed.isManifest- True if manifest, false if switch list.
-
pickUpCar
protected void pickUpCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the manifest or switch list format- Parameters:
file- Manifest or switch list Filecar- The car being printed.isManifest- True if manifest, false if switch list.
-
pickupCar
public java.lang.String pickupCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the pick up car string. Useful for frames like train conductor and yardmaster.- Parameters:
car- The car being printed.isManifest- when true use manifest format, when false use switch list formatisTwoColumnTrack- True if printing using two column format sorted by track name.- Returns:
- pick up car string
-
truncatedDropCar
protected void truncatedDropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the truncated manifest format. Does not print out local moves. Local moves are only shown on the switch list for that location.- Parameters:
file- Manifest or switch list Filecar- The car being printed.isManifest- True if manifest, false if switch list.
-
dropCar
protected void dropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the manifest or switch list format- Parameters:
file- Manifest or switch list Filecar- The car being printed.isManifest- True if manifest, false if switch list.
-
dropCar
public java.lang.String dropCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the drop car string. Useful for frames like train conductor and yardmaster.- Parameters:
car- The car being printed.isManifest- when true use manifest format, when false use switch list formatisTwoColumnTrack- True if printing using two column format.- Returns:
- drop car string
-
localMoveCar
public java.lang.String localMoveCar(Car car, boolean isManifest)
Returns the move car string. Useful for frames like train conductor and yardmaster.- Parameters:
car- The car being printed.isManifest- when true use manifest format, when false use switch list format- Returns:
- move car string
-
pickupUtilityCars
protected void pickupUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for pick up from the route location to the output file. The cars are blocked by destination.- Parameters:
file- Manifest or Switch List File.carList- List of cars for this train.car- The utility car.isTruncate- True if manifest is to be truncatedisManifest- True if manifest, false if switch list.
-
setoutUtilityCars
protected void setoutUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for drop at the route location to the output file.- Parameters:
file- Manifest or Switch List File.carList- List of cars for this train.car- The utility car.isTruncate- True if manifest is to be truncatedisManifest- True if manifest, false if switch list.
-
pickupUtilityCars
public java.lang.String pickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest, boolean isTwoColumnTrack)
-
countPickupUtilityCars
public int countPickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest)
-
setoutUtilityCars
public java.lang.String setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
For the Conductor and Yardmaster windows.- Parameters:
carList- List of cars for this train.car- The utility car.isLocal- True if local move.isManifest- True if manifest, false if switch list.- Returns:
- A string representing the work of identical utility cars.
-
setoutUtilityCars
protected java.lang.String setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest, boolean isTwoColumnTrack)
-
countSetoutUtilityCars
public int countSetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
-
countUtilityCars
protected int countUtilityCars(java.lang.String[] format, java.util.List<Car> carList, Car car, boolean isPickup)
Scans the car list for utility cars that have the same attributes as the car provided. Returns 0 if this car type has already been processed, otherwise the number of cars with the same attribute.- Parameters:
format- Message format.carList- List of cars for this traincar- The utility car.isPickup- True if pick up, false if set out.- Returns:
- 0 if the car type has already been processed
-
clearUtilityCarTypes
public void clearUtilityCarTypes()
-
addLine
public static void addLine(java.io.PrintWriter file, java.lang.String level, java.lang.String string)
Writes a line to the build report file- Parameters:
file- build report filelevel- print levelstring- string to write
-
addLine
protected void addLine(java.io.PrintWriter file, java.lang.String string)
Writes string to file. No line length wrap or protection.- Parameters:
file- The File to write to.string- The string to write.
-
newLine
protected void newLine(java.io.PrintWriter file, java.lang.String string, boolean isManifest)
Writes a string to a file. Checks for string length, and will automatically wrap lines.- Parameters:
file- The File to write to.string- The string to write.isManifest- set true for manifest page orientation, false for switch list orientation
-
newLine
protected void newLine(java.io.PrintWriter file)
Adds a blank line to the file.- Parameters:
file- The File to write to.
-
splitString
public static java.lang.String splitString(java.lang.String name)
Splits a string (example-number) as long as the second part of the string is an integer or if the first character after the hyphen is a left parenthesis "(".- Parameters:
name- The string to split if necessary.- Returns:
- First half of the string.
-
splitStringLeftParenthesis
public static java.lang.String splitStringLeftParenthesis(java.lang.String name)
Splits a string if there's a hyphen followed by a left parenthesis "-(".- Parameters:
name- the string to split- Returns:
- First half of the string.
-
isThereWorkAtLocation
protected boolean isThereWorkAtLocation(java.util.List<Car> carList, java.util.List<Engine> engList, RouteLocation rl)
-
isThereWorkAtLocation
public static boolean isThereWorkAtLocation(Train train, Location location)
returns true if the train has work at the location- Parameters:
train- The Train.location- The Location.- Returns:
- true if the train has work at the location
-
addCarsLocationUnknown
protected void addCarsLocationUnknown(java.io.PrintWriter file, boolean isManifest)
-
printEngineHeader
public void printEngineHeader(java.io.PrintWriter file, boolean isManifest)
Two column header format. Left side pick ups, right side set outs- Parameters:
file- Manifest or switch list File.isManifest- True if manifest, false if switch list.
-
printPickupEngineHeader
public void printPickupEngineHeader(java.io.PrintWriter file, boolean isManifest)
-
printDropEngineHeader
public void printDropEngineHeader(java.io.PrintWriter file, boolean isManifest)
-
printCarHeader
public void printCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
Prints the two column header for cars. Left side pick ups, right side set outs.- Parameters:
file- Manifest or Switch List FileisManifest- True if manifest, false if switch list.isTwoColumnTrack- True if two column format using track names.
-
printPickupCarHeader
public void printPickupCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
-
printDropCarHeader
public void printDropCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
-
printLocalCarMoveHeader
public void printLocalCarMoveHeader(java.io.PrintWriter file, boolean isManifest)
-
getPickupEngineHeader
public java.lang.String getPickupEngineHeader()
-
getDropEngineHeader
public java.lang.String getDropEngineHeader()
-
getPickupCarHeader
public java.lang.String getPickupCarHeader(boolean isManifest, boolean isTwoColumnTrack)
-
getDropCarHeader
public java.lang.String getDropCarHeader(boolean isManifest, boolean isTwoColumnTrack)
-
getLocalMoveHeader
public java.lang.String getLocalMoveHeader(boolean isManifest)
-
printTrackNameHeader
protected void printTrackNameHeader(java.io.PrintWriter file, java.lang.String trackName, boolean isManifest)
-
printHorizontalLine1
public void printHorizontalLine1(java.io.PrintWriter file, boolean isManifest)
-
printHorizontalLine2
public void printHorizontalLine2(java.io.PrintWriter file, boolean isManifest)
-
printHorizontalLine3
public void printHorizontalLine3(java.io.PrintWriter file, boolean isManifest)
-
printHorizontalLine
public void printHorizontalLine(java.io.PrintWriter file, boolean isManifest)
Prints a line across the entire page.- Parameters:
file- The File to print to.isManifest- True if manifest, false if switch list.
-
printHorizontalLine
public void printHorizontalLine(java.io.PrintWriter file, int start, int end)
-
getISO8601Date
public static java.lang.String getISO8601Date(boolean isModelYear)
-
getDate
public static java.lang.String getDate(java.util.Date date)
-
getDate
public static java.lang.String getDate(boolean isModelYear)
-
convertStringToDate
public static java.util.Date convertStringToDate(java.lang.String date)
-
convertStringTime
protected int convertStringTime(java.lang.String time)
-
padAndTruncateIfNeeded
public static java.lang.String padAndTruncateIfNeeded(java.lang.String s, int fieldSize)
Pads out a string by adding spaces to the end of the string, and will remove characters from the end of the string if the string exceeds the field size.- Parameters:
s- The string to pad.fieldSize- The maximum length of the string.- Returns:
- A String the specified length
-
padAndTruncate
public static java.lang.String padAndTruncate(java.lang.String s, int fieldSize)
-
padString
public static java.lang.String padString(java.lang.String s, int fieldSize)
Adjusts string to be a certain number of characters by adding spaces to the end of the string.- Parameters:
s- The string to padfieldSize- The fixed length of the string.- Returns:
- A String the specified length
-
createTabIfNeeded
public static java.lang.String createTabIfNeeded(int tabSize)
Creates a String of spaces to create a tab for text. Tabs must be enabled. Setup.isTabEnabled()- Parameters:
tabSize- the length of tab- Returns:
- tab
-
tabString
protected static java.lang.String tabString(java.lang.String s, int tabSize)
-
getLineLength
public static int getLineLength(boolean isManifest)
Returns the line length for manifest or switch list printout. Always an even number.- Parameters:
isManifest- True if manifest.- Returns:
- line length for manifest or switch list.
-
getManifestHeaderLineLength
public static int getManifestHeaderLineLength()
-
getPageSize
protected static java.awt.Dimension getPageSize(java.lang.String orientation)
-
formatStringToCommaSeparated
public static java.lang.String formatStringToCommaSeparated(java.lang.String[] array)
Produces a string using commas and spaces between the strings provided in the array. Does not check for embedded commas in the string array.- Parameters:
array- The string array to be formated.- Returns:
- formated string using commas and spaces
-
formatColorString
public static java.lang.String formatColorString(java.lang.String text, java.awt.Color color)
Adds HTML like color text control characters around a string. Note that black is the standard text color, and if black is requested no control characters are added.- Parameters:
text- the text to be modifiedcolor- the color the text is to be printed- Returns:
- formated text with color modifiers
-
getTextColorString
public static java.lang.String getTextColorString(java.lang.String string)
Removes the color text control characters around the desired string- Parameters:
string- the string with control characters- Returns:
- pure text
-
getTextColor
public static java.awt.Color getTextColor(java.lang.String string)
-
getTextColorName
public static java.lang.String getTextColorName(java.lang.String string)
-
-