Package jmri.jmrit.operations.trains
Class Train
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.trains.Train
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Identifiable,PropertyChangeFirer,PropertyChangeProvider
Represents a train on the layout
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected Stringprotected booleanprotected booleanprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected RouteLocationprotected Dateprotected Stringprotected Trackprotected Stringprotected RouteLocationprotected Stringprotected Stringprotected Stringprotected Engineprotected Stringprotected Stringprotected Stringprotected Stringprotected intprotected Stringprotected RouteLocationprotected Stringprotected RouteLocationprotected Stringprotected Stringprotected intprotected Stringprotected RouteLocationprotected Stringprotected Stringprotected Stringprotected booleanprotected Stringprotected Stringprotected intprotected Stringprotected booleanprotected Stringprotected intprotected Routeprotected booleanprotected booleanprotected booleanprotected Stringprotected booleanprotected intprotected intprotected String(package private) TrainIconAnimationprotected Stringprotected Stringprotected Trackprotected TrainIconstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final Stringstatic final Stringprotected static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAfterBuildScript(String pathname) Add a script to run after a train is builtvoidaddBuildScript(String pathname) Add a script to run before a train is builtbooleanaddCabooseRoadName(String road) Add a caboose road name that the train will either service or exclude.booleanaddCarRoadName(String road) Add a car road name that the train will either service or exclude.booleanaddLoadName(String load) Add a load that the train will either service or exclude.booleanaddLocoRoadName(String road) Add a engine road name that the train will either service or exclude.voidaddMoveScript(String pathname) Add a script to run when train is movedbooleanaddOwnerName(String owner) Add a owner name that the train will either service or exclude.voidaddTerminationScript(String pathname) Add a script to run when train is terminatedvoidTrain will skip the RouteLocationvoidaddTypeName(String type) Add a car or engine type name that this train will service.booleanbuild()Build this train.booleanBuild this train if the build control flag is true.booleanChecks to see if the train's staging departure track has been taken by another train.voidvoiddeleteAfterBuildScript(String pathname) voiddeleteBuildScript(String pathname) booleandeleteCabooseRoadName(String road) Delete a caboose road name that the train will either service or exclude.booleandeleteCarRoadName(String road) Delete a car road name that the train will either service or exclude.booleandeleteLoadName(String load) Delete a load name that the train will either service or exclude.booleandeleteLocoRoadName(String road) Delete a engine road name that the train will either service or exclude.voiddeleteMoveScript(String pathname) booleandeleteOwnerName(String owner) Delete a owner name that the train will either service or exclude.voiddeleteTerminationScript(String pathname) voidvoiddeleteTypeName(String type) voiddispose()Gets a list of pathnames (scripts) to run after this train is builtprotected StringGets a list of pathnames (scripts) to run before this train is builtGets the current caboose road and number if there's one assigned to the train.String[]Provides a list of caboose road names that the train will either service or exclude.Get how this train deals with caboose road names.String[]Provides a list of car road names that the train will either service or exclude.Get how this train deals with car road names.String[]Get train's current location nameGet train's current route locationgetDate()intGet train's departure time in minutes from midnight for sortingGet's train's departure timeReturns a formated string providing the train's description. {0} = lead engine number, {1} = train's departure direction {2} = lead engine road {3} = DCC address of lead engine.Get the road name of engines servicing this train.getExpectedArrivalTime(RouteLocation routeLocation) Gets the expected time when this train will arrive at the location rl.getExpectedArrivalTime(RouteLocation routeLocation, boolean isSortFormat) getExpectedDepartureTime(RouteLocation routeLocation) getExpectedDepartureTime(RouteLocation routeLocation, boolean isSortFormat) intgetExpectedTravelTimeInMinutes(RouteLocation routeLocation) Used to determine when a train will arrive at a train's route location.Get's train's departure time in 12hr or 24hr formatgetId()Get the identity of the object.Gets the lead engine, will create it if the program has been restartedgetLeadEngine(RouteLocation routeLocation) Returns the lead engine in a train's route.String[]Provides a list of loads that the train will either service or exclude.Gets the car load option for this train.String[]Provides a list of engine road names that the train will either service or exclude.Get how this train deals with locomotive road names.String[]Gets a list of pathnames (scripts) to run when this train movedgetName()Get's a train's nameGet the train's next location namegetNextLocationName(int number) Get a location name in a train's route from the current train's location.getNextRouteLocation(RouteLocation currentRouteLocation) intGets the number of cars in the train at the current location in the train's route.intgetNumberCarsInTrain(RouteLocation routeLocation) Gets the number of cars in the train when train departs the route location.intintgetNumberCarsPickedUp(RouteLocation routeLocation) Gets the number of cars pulled from a locationintintintgetNumberCarsSetout(RouteLocation routeLocation) Gets the number of cars delivered to a locationintintgetNumberEmptyCarsInTrain(RouteLocation routeLocation) Gets the number of empty cars in the train when train departs the route location.Get the number of engines that this train requires.intgetNumberLoadedCarsInTrain(RouteLocation routeLocation) protected intString[]Provides a list of owner names that the train will either service or exclude.Gets the optional railroad name for this train.intGet a train's requirements with regards to the last car in the train.getRoute()Gets the train's routeGet the road name of engines servicing this train 2nd leg.Get the number of engines needed for the second set.intReturns the statusCode of the "isServiceable(Car)" routine.Get train's status in the default locale.Get train's status in the specified locale.Get the human-readable status for the requested status code.intGets a list of pathnames (scripts) to run when this train terminatesGet the road name of engines servicing this train 3rd leg.Get the number of engines needed for the third set.intReturns the order the train should be blocked.Get the train's departure location's nameintgetTrainHorsePower(RouteLocation routeLocation) Gets the train's locomotive horsepower at the route location specifiedintGets the train's length at the current location in the train's route.intgetTrainLength(RouteLocation routeLocation) Gets the train's length at the route location specifiedGet's the train's route name.protected String[]Get train's final location's nameintGet the train's weight at the current location.intgetTrainWeight(RouteLocation routeLocation) String[]Get's the type names of rolling stock this train will serviceintgetWorkTimeAtLocation(RouteLocation routeLocation) booleanAllow local moves if car has a custom load or Final DestinationbooleanWhen true allow a turn to return cars to staging.booleanbooleanbooleanUsed to determine if train is to be built.booleanReturns true if the train build failed.booleanbooleanisBuilt()Used to determine if this train has been built.booleanisBuiltDateAccepted(String date) Determine if train will service rolling stock by built date.booleanbooleanDetermine if train will service a specific road name for a caboose.booleanisCarRoadNameAccepted(String road) Determine if train will service a specific road name for a car.booleanbooleanbooleanisLoadNameAccepted(String load) Determine if train will service a specific load name.booleanisLoadNameAccepted(String load, String type) Determine if train will service a specific load and car type.booleanUsed to determine if train is a local switcher serving one location.booleanDetermines if this train skips a location (doesn't service the location).booleanisLocoRoadNameAccepted(String road) Determine if train will service a specific road name for an engine.booleanbooleanUsed to determine if train is carrying only passenger cars.booleanisOwnerNameAccepted(String owner) Determine if train will service a specific owner name.booleanUsed to determine if train manifest was printed.booleanbooleanbooleanisServiceable(PrintWriter buildReport, Car car) Note that this code was written after TrainBuilder.booleanisServiceable(Car car) Determines if this train will service this car.booleanbooleanbooleanisTrainAbleToService(PrintWriter buildReport, Car car) booleanUsed to determine if train has departed the first location in the train's routebooleanisTurn()booleanisTypeNameAccepted(String type) Returns true if this train will service the type of car or engine.voidvoidmove()Move train to next location in the route.booleanMove train to a location in the train's route.booleanmove(RouteLocation rl) Moves the train to the specified route locationbooleanmoveToNextLocation(String locationName) Move train to the next location in the train's route.voidbooleanopenFile()booleanbooleanprintBuildReport(boolean isPreview) booleanprintManifest(boolean isPreview) Print manifest for train.booleanPrint manifest for train if already built.voidprotected voidreplaceModel(String oldModel, String newModel) protected voidreplaceOwner(String oldName, String newName) protected voidreplaceRoad(String oldRoad, String newRoad) protected voidreplaceType(String oldType, String newType) booleanreset()Resets the train, removes engines and cars from this train.booleanrunFile()voidsetAllowLocalMovesEnabled(boolean enable) voidsetAllowReturnToStagingEnabled(boolean enable) voidsetAllowThroughCarsEnabled(boolean enable) voidsetBuildConsistEnabled(boolean enable) voidsetBuildEnabled(boolean build) Control flag used to decide if this train is to be built.voidsetBuildFailed(boolean status) voidsetBuildFailedMessage(String message) voidsetBuildTrainNormalEnabled(boolean enable) voidsetBuilt(boolean built) voidsetBuiltEndYear(String year) Only rolling stock built in or before this year will be used.voidsetBuiltStartYear(String year) Only rolling stock built in or after this year will be used.voidsetCabooseRoad(String road) Set the road name of the caboose servicing this train.protected voidsetCabooseRoadNames(String[] roads) voidsetCabooseRoadOption(String option) Set how this train deals with caboose road names.voidsetCarRoadNames(String[] roads) voidsetCarRoadOption(String option) Set how this train deals with car road names.voidsetComment(String comment) voidsetCurrentLocation(RouteLocation location) Set train's current route locationvoidvoidsetDepartureTime(String hour, String minute) voidsetDepartureTrack(Track track) voidsetDescription(String description) protected voidsetDirtyAndFirePropertyChange(String p, Object old, Object n) voidsetEngineModel(String model) Set the model name of engines servicing this train.voidsetEngineRoad(String road) Set the road name of engines servicing this train.voidsetLeadEngine(Engine engine) voidsetLoadNames(String[] loads) voidsetLoadOption(String option) Set how this train deals with car loadsvoidsetLocoRoadNames(String[] roads) voidsetLocoRoadOption(String option) Set how this train deals with locomotive road names.voidsetManifestLogoPathName(String pathName) Overrides the default logo for this train.voidsetModified(boolean modified) Set true whenever the train's manifest has been modified.voidSets the name of this train, normally a short name that can fit within the train icon.voidsetNumberCarsRequested(int number) voidsetNumberEngines(String number) protected voidsetOldStatusCode(int code) voidsetOwnerNames(String[] owners) voidsetOwnerOption(String option) Set how this train deals with car owner namesvoidsetPrinted(boolean printed) voidsetRailroadName(String name) Overrides the default railroad name for this train.voidsetRequirements(int requires) Set train requirements.voidvoidSet the road name of the second leg caboose servicing this train.voidvoidsetSecondLegEngineModel(String model) Set the model name of engines servicing this train's 2nd leg.voidsetSecondLegEngineRoad(String road) Set the road name of engines servicing this train 2nd leg.voidsetSecondLegNumberEngines(String number) voidsetSecondLegOptions(int options) Optional changes to train while en route.voidvoidsetSendCarsToTerminalEnabled(boolean enable) voidsetSendCarsWithCustomLoadsToStagingEnabled(boolean enable) voidsetServiceAllCarsWithFinalDestinationsEnabled(boolean enable) protected voidsetServiceStatus(String status) voidsetShowArrivalAndDepartureTimes(boolean enable) voidsetStatusCode(int code) Set the train's machine readable status.voidsetSwitchListStatus(String status) Sets the print status for switch listsvoidsetTableRowColorName(String colorName) voidsetTableRowColorNameReset(String colorName) voidsetTerminationTrack(Track track) voidsetThirdLegCabooseRoad(String road) Set the road name of the third leg caboose servicing this train.voidvoidsetThirdLegEngineModel(String model) Set the model name of engines servicing this train's 3rd leg.voidsetThirdLegEngineRoad(String road) Set the road name of engines servicing this train 3rd leg.voidsetThirdLegNumberEngines(String number) voidsetThirdLegOptions(int options) Optional changes to train while en route.voidbooleanSets the panel position for the train icon for the current route location.protected voidsetTrainSkipsLocations(String[] locationIds) protected voidsetTypeNames(String[] types) Set the type of cars or engines this train will service, see types in Cars and Engines.org.jdom2.Elementstore()Create an XML element to represent this Entry.voidTerminate train.toString()Get's a train's namevoidMethods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
NONE
- See Also:
-
_id
-
_name
-
_description
-
_current
-
_buildFailedMessage
-
_built
-
_modified
-
_build
-
_buildFailed
-
_printed
-
_sendToTerminal
-
_allowLocalMoves
-
_allowThroughCars
-
_buildNormal
-
_allowCarsReturnStaging
-
_serviceAllCarsWithFinalDestinations
-
_buildConsist
-
_sendCarsWithCustomLoadsToStaging
-
_route
-
_departureTrack
-
_terminationTrack
-
_carRoadOption
-
_carRoadList
-
_cabooseRoadOption
-
_cabooseRoadList
-
_locoRoadOption
-
_locoRoadList
-
_requires
-
_numberEngines
-
_engineRoad
-
_engineModel
-
_cabooseRoad
-
_departureTime
-
_leadEngineId
-
_builtStartYear
-
_builtEndYear
-
_loadOption
-
_ownerOption
-
_buildScripts
-
_afterBuildScripts
-
_moveScripts
-
_terminationScripts
-
_railroadName
-
_logoPathName
-
_showTimes
-
_leadEngine
-
_switchListStatus
-
_comment
-
_serviceStatus
-
_statusCode
-
_oldStatusCode
-
_date
-
_statusCarsRequested
-
_tableRowColorName
-
_tableRowColorResetName
-
_leg2Options
-
_leg2Start
-
_end2Leg
-
_leg2Engines
-
_leg2Road
-
_leg2Model
-
_leg2CabooseRoad
-
_leg3Options
-
_leg3Start
-
_leg3End
-
_leg3Engines
-
_leg3Road
-
_leg3Model
-
_leg3CabooseRoad
-
CHANGE_ENGINES
- See Also:
-
HELPER_ENGINES
- See Also:
-
ADD_CABOOSE
- See Also:
-
REMOVE_CABOOSE
- See Also:
-
ADD_ENGINES
- See Also:
-
REMOVE_ENGINES
- See Also:
-
DISPOSE_CHANGED_PROPERTY
- See Also:
-
STOPS_CHANGED_PROPERTY
- See Also:
-
TYPES_CHANGED_PROPERTY
- See Also:
-
BUILT_CHANGED_PROPERTY
- See Also:
-
BUILT_YEAR_CHANGED_PROPERTY
- See Also:
-
BUILD_CHANGED_PROPERTY
- See Also:
-
ROADS_CHANGED_PROPERTY
- See Also:
-
LOADS_CHANGED_PROPERTY
- See Also:
-
OWNERS_CHANGED_PROPERTY
- See Also:
-
NAME_CHANGED_PROPERTY
- See Also:
-
DESCRIPTION_CHANGED_PROPERTY
- See Also:
-
STATUS_CHANGED_PROPERTY
- See Also:
-
DEPARTURETIME_CHANGED_PROPERTY
- See Also:
-
TRAIN_LOCATION_CHANGED_PROPERTY
- See Also:
-
TRAIN_ROUTE_CHANGED_PROPERTY
- See Also:
-
TRAIN_REQUIREMENTS_CHANGED_PROPERTY
- See Also:
-
TRAIN_MOVE_COMPLETE_CHANGED_PROPERTY
- See Also:
-
TRAIN_ROW_COLOR_CHANGED_PROPERTY
- See Also:
-
TRAIN_ROW_COLOR_RESET_CHANGED_PROPERTY
- See Also:
-
TRAIN_MODIFIED_CHANGED_PROPERTY
- See Also:
-
TRAIN_CURRENT_CHANGED_PROPERTY
- See Also:
-
TRAIN_RESET
-
RUN_SCRIPTS
-
BUILDING
-
BUILD_FAILED
-
BUILT
-
PARTIAL_BUILT
-
TRAIN_EN_ROUTE
-
TERMINATED
-
MANIFEST_MODIFIED
-
CODE_TRAIN_RESET
- See Also:
-
CODE_RUN_SCRIPTS
- See Also:
-
CODE_BUILDING
- See Also:
-
CODE_BUILD_FAILED
- See Also:
-
CODE_BUILT
- See Also:
-
CODE_PARTIAL_BUILT
- See Also:
-
CODE_TRAIN_EN_ROUTE
- See Also:
-
CODE_TERMINATED
- See Also:
-
CODE_MANIFEST_MODIFIED
- See Also:
-
CODE_UNKNOWN
- See Also:
-
NO_CABOOSE_OR_FRED
- See Also:
-
CABOOSE
- See Also:
-
FRED
- See Also:
-
ALL_ROADS
-
INCLUDE_ROADS
-
EXCLUDE_ROADS
-
ALL_OWNERS
-
INCLUDE_OWNERS
-
EXCLUDE_OWNERS
-
ALL_LOADS
-
INCLUDE_LOADS
-
EXCLUDE_LOADS
-
UNKNOWN
- See Also:
-
PRINTED
-
AUTO
-
AUTO_HPT
-
ALREADY_SERVICED
- See Also:
-
_skipLocationsList
-
_typeList
-
_loadList
-
_ownerList
-
SEVEN
- See Also:
-
_ta
-
_trainIcon
-
-
Constructor Details
-
Train
-
Train
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-trains.dtd- Parameters:
e- Consist XML element
-
-
Method Details
-
getId
Description copied from interface:IdentifiableGet the identity of the object.- Specified by:
getIdin interfaceIdentifiable- Returns:
- the identity
-
setName
Sets the name of this train, normally a short name that can fit within the train icon.- Parameters:
name- the train's name.
-
toString
Get's a train's name -
getName
Get's a train's name- Returns:
- train's name
-
getSplitName
-
getTableRowColorName
- Returns:
- The name of the color when highlighting the train's row
-
setTableRowColorName
-
getTableRowColorNameReset
- Returns:
- The name of the train row color when the train is reset
-
setTableRowColorNameReset
-
getTableRowColor
- Returns:
- The color when highlighting the train's row
-
getDepartureTime
Get's train's departure time- Returns:
- train's departure time in the String format hh:mm
-
getFormatedDepartureTime
Get's train's departure time in 12hr or 24hr format- Returns:
- train's departure time in the String format hh:mm or hh:mm AM/PM
-
getDepartTimeMinutes
Get train's departure time in minutes from midnight for sorting- Returns:
- int hh*60+mm
-
setDepartureTime
-
getDepartureTimeHour
-
getDepartureTimeMinute
-
getExpectedArrivalTime
Gets the expected time when this train will arrive at the location rl. Expected arrival time is based on the number of car pick up and set outs for this train. TODO Doesn't provide expected arrival time if train is in route, instead provides relative time. If train is at or has passed the location return -1.- Parameters:
routeLocation- The RouteLocation.- Returns:
- expected arrival time in minutes (append AM or PM if 12 hour format)
-
getExpectedArrivalTime
-
getExpectedDepartureTime
-
getExpectedDepartureTime
-
getWorkTimeAtLocation
-
getExpectedTravelTimeInMinutes
Used to determine when a train will arrive at a train's route location. Once a train departs, provides an estimated time in route and ignores the departure times from each route location.- Parameters:
routeLocation- where in the train's route to get time- Returns:
- Time in minutes
-
setRequirements
Set train requirements. If NO_CABOOSE_OR_FRED, then train doesn't require a caboose or car with FRED.- Parameters:
requires- NO_CABOOSE_OR_FRED, CABOOSE, FRED
-
getRequirements
Get a train's requirements with regards to the last car in the train.- Returns:
- NONE CABOOSE FRED
-
isCabooseNeeded
-
isFredNeeded
-
setRoute
-
getRoute
Gets the train's route- Returns:
- train's route
-
getTrainRouteName
Get's the train's route name.- Returns:
- Train's route name.
-
getTrainDepartsName
Get the train's departure location's name- Returns:
- train's departure location's name
-
getTrainDepartsRouteLocation
-
getTrainDepartsDirection
-
getTrainTerminatesName
Get train's final location's name- Returns:
- train's final location's name
-
getTrainTerminatesRouteLocation
-
getTrainBlockingOrder
Returns the order the train should be blocked.- Returns:
- routeLocations for this train.
-
setCurrentLocation
Set train's current route location- Parameters:
location- The current RouteLocation.
-
getCurrentLocationName
Get train's current location name- Returns:
- Train's current route location name
-
getCurrentRouteLocation
Get train's current route location- Returns:
- Train's current route location
-
getNextLocationName
Get the train's next location name- Returns:
- Train's next route location name
-
getNextLocationName
Get a location name in a train's route from the current train's location. A number of "1" means get the next location name in a train's route.- Parameters:
number- The stop number, must be greater than 0- Returns:
- Name of the location that is the number of stops away from the train's current location.
-
getNextRouteLocation
-
setDepartureTrack
-
getDepartureTrack
-
isDepartingStaging
-
setTerminationTrack
-
getTerminationTrack
-
setStatusCode
Set the train's machine readable status. Calls update train table row color.- Parameters:
code- machine readable
-
updateTrainTableRowColor
-
getStatus
Get train's status in the default locale.- Returns:
- Human-readable status
-
getStatus
Get train's status in the specified locale.- Parameters:
locale- The Locale.- Returns:
- Human-readable status
-
getStatus
Get the human-readable status for the requested status code.- Parameters:
locale- The Locale.code- requested status- Returns:
- Human-readable status
-
getMRStatus
-
getStatusCode
-
setOldStatusCode
-
getOldStatusCode
-
isTrainEnRoute
Used to determine if train has departed the first location in the train's route- Returns:
- true if train has departed
-
isLocalSwitcher
Used to determine if train is a local switcher serving one location. Note the train can have more than location in its route, but all location names must be "same". See TrainCommon.splitString(String name) for the definition of the "same" name.- Returns:
- true if local switcher
-
isTurn
-
isOnlyPassengerCars
Used to determine if train is carrying only passenger cars.- Returns:
- true if only passenger cars have been assigned to this train.
-
getTrainSkipsLocations
-
setTrainSkipsLocations
-
addTrainSkipsLocation
Train will skip the RouteLocation- Parameters:
rl- RouteLocation
-
deleteTrainSkipsLocation
-
isLocationSkipped
Determines if this train skips a location (doesn't service the location).- Parameters:
rl- The route location.- Returns:
- true if the train will not service the location.
-
getTypeNames
Get's the type names of rolling stock this train will service- Returns:
- The type names for cars and or engines
-
getCarTypeNames
-
getLocoTypeNames
-
setTypeNames
Set the type of cars or engines this train will service, see types in Cars and Engines.- Parameters:
types- The type names for cars and or engines
-
addTypeName
Add a car or engine type name that this train will service.- Parameters:
type- The new type name to service.
-
deleteTypeName
-
isTypeNameAccepted
Returns true if this train will service the type of car or engine.- Parameters:
type- The car or engine type name.- Returns:
- true if this train will service the particular type.
-
replaceType
-
getCarRoadOption
Get how this train deals with car road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCarRoadOption
Set how this train deals with car road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCarRoadNames
-
getCarRoadNames
Provides a list of car road names that the train will either service or exclude. See setCarRoadOption- Returns:
- Array of sorted road names as Strings
-
addCarRoadName
Add a car road name that the train will either service or exclude. See setCarRoadOption- Parameters:
road- The string road name.- Returns:
- true if road name was added, false if road name wasn't in the list.
-
deleteCarRoadName
Delete a car road name that the train will either service or exclude. See setRoadOption- Parameters:
road- The string road name to delete.- Returns:
- true if road name was removed, false if road name wasn't in the list.
-
isCarRoadNameAccepted
Determine if train will service a specific road name for a car.- Parameters:
road- the road name to check.- Returns:
- true if train will service this road name.
-
getCabooseRoadOption
Get how this train deals with caboose road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCabooseRoadOption
Set how this train deals with caboose road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCabooseRoadNames
-
getCabooseRoadNames
Provides a list of caboose road names that the train will either service or exclude. See setCabooseRoadOption- Returns:
- Array of sorted road names as Strings
-
addCabooseRoadName
Add a caboose road name that the train will either service or exclude. See setCabooseRoadOption- Parameters:
road- The string road name.- Returns:
- true if road name was added, false if road name wasn't in the list.
-
deleteCabooseRoadName
Delete a caboose road name that the train will either service or exclude. See setRoadOption- Parameters:
road- The string road name to delete.- Returns:
- true if road name was removed, false if road name wasn't in the list.
-
isCabooseRoadNameAccepted
Determine if train will service a specific road name for a caboose.- Parameters:
road- the road name to check.- Returns:
- true if train will service this road name.
-
getLocoRoadOption
Get how this train deals with locomotive road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setLocoRoadOption
Set how this train deals with locomotive road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setLocoRoadNames
-
getLocoRoadNames
Provides a list of engine road names that the train will either service or exclude. See setLocoRoadOption- Returns:
- Array of sorted road names as Strings
-
addLocoRoadName
Add a engine road name that the train will either service or exclude. See setLocoRoadOption- Parameters:
road- The string road name.- Returns:
- true if road name was added, false if road name wasn't in the list.
-
deleteLocoRoadName
Delete a engine road name that the train will either service or exclude. See setLocoRoadOption- Parameters:
road- The string road name to delete.- Returns:
- true if road name was removed, false if road name wasn't in the list.
-
isLocoRoadNameAccepted
Determine if train will service a specific road name for an engine.- Parameters:
road- the road name to check.- Returns:
- true if train will service this road name.
-
replaceRoad
-
getLoadOption
Gets the car load option for this train.- Returns:
- ALL_LOADS INCLUDE_LOADS EXCLUDE_LOADS
-
setLoadOption
Set how this train deals with car loads- Parameters:
option- ALL_LOADS INCLUDE_LOADS EXCLUDE_LOADS
-
setLoadNames
-
getLoadNames
Provides a list of loads that the train will either service or exclude. See setLoadOption- Returns:
- Array of load names as Strings
-
addLoadName
Add a load that the train will either service or exclude. See setLoadOption- Parameters:
load- The string load name.- Returns:
- true if load name was added, false if load name wasn't in the list.
-
deleteLoadName
Delete a load name that the train will either service or exclude. See setLoadOption- Parameters:
load- The string load name.- Returns:
- true if load name was removed, false if load name wasn't in the list.
-
isLoadNameAccepted
Determine if train will service a specific load name.- Parameters:
load- the load name to check.- Returns:
- true if train will service this load.
-
isLoadNameAccepted
Determine if train will service a specific load and car type.- Parameters:
load- the load name to check.type- the type of car used to carry the load.- Returns:
- true if train will service this load.
-
getOwnerOption
-
setOwnerOption
Set how this train deals with car owner names- Parameters:
option- ALL_OWNERS INCLUDE_OWNERS EXCLUDE_OWNERS
-
setOwnerNames
-
getOwnerNames
Provides a list of owner names that the train will either service or exclude. See setOwnerOption- Returns:
- Array of owner names as Strings
-
addOwnerName
Add a owner name that the train will either service or exclude. See setOwnerOption- Parameters:
owner- The string representing the owner's name.- Returns:
- true if owner name was added, false if owner name wasn't in the list.
-
deleteOwnerName
Delete a owner name that the train will either service or exclude. See setOwnerOption- Parameters:
owner- The string representing the owner's name.- Returns:
- true if owner name was removed, false if owner name wasn't in the list.
-
isOwnerNameAccepted
Determine if train will service a specific owner name.- Parameters:
owner- the owner name to check.- Returns:
- true if train will service this owner name.
-
replaceOwner
-
setBuiltStartYear
Only rolling stock built in or after this year will be used.- Parameters:
year- A string representing a year.
-
getBuiltStartYear
-
setBuiltEndYear
Only rolling stock built in or before this year will be used.- Parameters:
year- A string representing a year.
-
getBuiltEndYear
-
isBuiltDateAccepted
Determine if train will service rolling stock by built date.- Parameters:
date- A string representing the built date for a car or engine.- Returns:
- true is built date is in the acceptable range.
-
isServiceable
Determines if this train will service this car. Note this code doesn't check the location or tracks that needs to be done separately. See Router.java.- Parameters:
car- The car to be tested.- Returns:
- true if this train can service the car.
-
isServiceable
Note that this code was written after TrainBuilder. It does pretty much the same as TrainBuilder but with much fewer build report messages.- Parameters:
buildReport- PrintWritercar- the car to be tested- Returns:
- true if this train can service the car.
-
isTrainAbleToService
-
setServiceStatus
-
getServiceStatus
Returns the statusCode of the "isServiceable(Car)" routine. There are two statusCodes that need special consideration when the train is being built, the moves in a train's route and the maximum train length. NOTE: The code using getServiceStatus() currently assumes that if there's a service status that the issue is either route moves or maximum train length.- Returns:
- The statusCode.
-
getNumberCarsWorked
- Returns:
- The number of cars worked by this train
-
setNumberCarsRequested
-
getNumberCarsRequested
-
setDate
-
getSortDate
-
getDate
-
getNumberCarsInTrain
Gets the number of cars in the train at the current location in the train's route.- Returns:
- The number of cars currently in the train
-
getNumberCarsInTrain
Gets the number of cars in the train when train departs the route location.- Parameters:
routeLocation- The RouteLocation.- Returns:
- The number of cars in the train departing the route location.
-
getNumberEmptyCarsInTrain
Gets the number of empty cars in the train when train departs the route location.- Parameters:
routeLocation- The RouteLocation.- Returns:
- The number of empty cars in the train departing the route location.
-
getNumberLoadedCarsInTrain
-
getNumberCarsPickedUp
-
getNumberCarsPickedUp
Gets the number of cars pulled from a location- Parameters:
routeLocation- the location- Returns:
- number of pick ups
-
getNumberCarsSetout
-
getNumberCarsSetout
Gets the number of cars delivered to a location- Parameters:
routeLocation- the location- Returns:
- number of set outs
-
getTrainLength
Gets the train's length at the current location in the train's route.- Returns:
- The train length at the train's current location
-
getTrainLength
Gets the train's length at the route location specified- Parameters:
routeLocation- The route location- Returns:
- The train length at the route location
-
getTrainWeight
Get the train's weight at the current location.- Returns:
- Train's weight in tons.
-
getTrainWeight
-
getTrainHorsePower
Gets the train's locomotive horsepower at the route location specified- Parameters:
routeLocation- The route location- Returns:
- The train's locomotive horsepower at the route location
-
getCabooseRoadAndNumber
Gets the current caboose road and number if there's one assigned to the train.- Returns:
- Road and number of caboose.
-
setDescription
-
getRawDescription
-
getDescription
Returns a formated string providing the train's description. {0} = lead engine number, {1} = train's departure direction {2} = lead engine road {3} = DCC address of lead engine.- Returns:
- The train's description.
-
setNumberEngines
-
getNumberEngines
Get the number of engines that this train requires.- Returns:
- The number of engines that this train requires.
-
getSecondLegNumberEngines
Get the number of engines needed for the second set.- Returns:
- The number of engines needed in route
-
setSecondLegNumberEngines
-
getThirdLegNumberEngines
Get the number of engines needed for the third set.- Returns:
- The number of engines needed in route
-
setThirdLegNumberEngines
-
setEngineRoad
Set the road name of engines servicing this train.- Parameters:
road- The road name of engines servicing this train.
-
getEngineRoad
Get the road name of engines servicing this train.- Returns:
- The road name of engines servicing this train.
-
setSecondLegEngineRoad
Set the road name of engines servicing this train 2nd leg.- Parameters:
road- The road name of engines servicing this train.
-
getSecondLegEngineRoad
Get the road name of engines servicing this train 2nd leg.- Returns:
- The road name of engines servicing this train.
-
setThirdLegEngineRoad
Set the road name of engines servicing this train 3rd leg.- Parameters:
road- The road name of engines servicing this train.
-
getThirdLegEngineRoad
Get the road name of engines servicing this train 3rd leg.- Returns:
- The road name of engines servicing this train.
-
setEngineModel
Set the model name of engines servicing this train.- Parameters:
model- The model name of engines servicing this train.
-
getEngineModel
-
setSecondLegEngineModel
Set the model name of engines servicing this train's 2nd leg.- Parameters:
model- The model name of engines servicing this train.
-
getSecondLegEngineModel
-
setThirdLegEngineModel
Set the model name of engines servicing this train's 3rd leg.- Parameters:
model- The model name of engines servicing this train.
-
getThirdLegEngineModel
-
replaceModel
-
setCabooseRoad
Set the road name of the caboose servicing this train.- Parameters:
road- The road name of the caboose servicing this train.
-
getCabooseRoad
-
setSecondLegCabooseRoad
Set the road name of the second leg caboose servicing this train.- Parameters:
road- The road name of the caboose servicing this train's 2nd leg.
-
getSecondLegCabooseRoad
-
setThirdLegCabooseRoad
Set the road name of the third leg caboose servicing this train.- Parameters:
road- The road name of the caboose servicing this train's 3rd leg.
-
getThirdLegCabooseRoad
-
setSecondLegStartRouteLocation
-
getSecondLegStartRouteLocation
-
getSecondLegStartLocationName
-
setThirdLegStartRouteLocation
-
getThirdLegStartRouteLocation
-
getThirdLegStartLocationName
-
setSecondLegEndRouteLocation
-
getSecondLegEndLocationName
-
getSecondLegEndRouteLocation
-
setThirdLegEndRouteLocation
-
getThirdLegEndRouteLocation
-
getThirdLegEndLocationName
-
setSecondLegOptions
Optional changes to train while en route.- Parameters:
options- NO_CABOOSE_OR_FRED, CHANGE_ENGINES, ADD_CABOOSE, HELPER_ENGINES, REMOVE_CABOOSE
-
getSecondLegOptions
-
setThirdLegOptions
Optional changes to train while en route.- Parameters:
options- NO_CABOOSE_OR_FRED, CHANGE_ENGINES, ADD_CABOOSE, HELPER_ENGINES, REMOVE_CABOOSE
-
getThirdLegOptions
-
setComment
-
getComment
-
getCommentWithColor
-
addBuildScript
Add a script to run before a train is built- Parameters:
pathname- The script's pathname
-
deleteBuildScript
-
getBuildScripts
Gets a list of pathnames (scripts) to run before this train is built- Returns:
- A list of pathnames to run before this train is built
-
addAfterBuildScript
Add a script to run after a train is built- Parameters:
pathname- The script's pathname
-
deleteAfterBuildScript
-
getAfterBuildScripts
Gets a list of pathnames (scripts) to run after this train is built- Returns:
- A list of pathnames to run after this train is built
-
addMoveScript
Add a script to run when train is moved- Parameters:
pathname- The script's pathname
-
deleteMoveScript
-
getMoveScripts
Gets a list of pathnames (scripts) to run when this train moved- Returns:
- A list of pathnames to run when this train moved
-
addTerminationScript
Add a script to run when train is terminated- Parameters:
pathname- The script's pathname
-
deleteTerminationScript
-
getTerminationScripts
Gets a list of pathnames (scripts) to run when this train terminates- Returns:
- A list of pathnames to run when this train terminates
-
getRailroadName
Gets the optional railroad name for this train.- Returns:
- Train's railroad name.
-
setRailroadName
Overrides the default railroad name for this train.- Parameters:
name- The railroad name for this train.
-
getManifestLogoPathName
-
setManifestLogoPathName
Overrides the default logo for this train.- Parameters:
pathName- file location for the logo.
-
isShowArrivalAndDepartureTimesEnabled
-
setShowArrivalAndDepartureTimes
-
isSendCarsToTerminalEnabled
-
setSendCarsToTerminalEnabled
-
isAllowLocalMovesEnabled
Allow local moves if car has a custom load or Final Destination- Returns:
- true if local move is allowed
-
setAllowLocalMovesEnabled
-
isAllowThroughCarsEnabled
-
setAllowThroughCarsEnabled
-
isBuildTrainNormalEnabled
-
setBuildTrainNormalEnabled
-
isAllowReturnToStagingEnabled
When true allow a turn to return cars to staging. A turn is a train that departs and terminates at the same location.- Returns:
- true if cars can return to staging
-
setAllowReturnToStagingEnabled
-
isServiceAllCarsWithFinalDestinationsEnabled
-
setServiceAllCarsWithFinalDestinationsEnabled
-
isBuildConsistEnabled
-
setBuildConsistEnabled
-
isSendCarsWithCustomLoadsToStagingEnabled
-
setSendCarsWithCustomLoadsToStagingEnabled
-
setBuilt
-
isBuilt
Used to determine if this train has been built.- Returns:
- true if the train was successfully built.
-
setModified
Set true whenever the train's manifest has been modified. For example adding or removing a car from a train, or changing the manifest format. Once the manifest has been regenerated (modified == false), the old status for the train is restored.- Parameters:
modified- True if train's manifest has been modified.
-
isModified
-
setBuildEnabled
Control flag used to decide if this train is to be built.- Parameters:
build- When true, build this train.
-
isBuildEnabled
Used to determine if train is to be built.- Returns:
- true if train is to be built.
-
buildIfSelected
Build this train if the build control flag is true.- Returns:
- True only if train is successfully built.
-
build
Build this train. Creates a train manifest.- Returns:
- True if build successful.
-
printBuildReport
-
printBuildReport
-
setBuildFailed
-
isBuildFailed
Returns true if the train build failed. Note that returning false doesn't mean the build was successful.- Returns:
- true if train build failed.
-
setBuildFailedMessage
-
getBuildFailedMessage
-
printManifestIfBuilt
Print manifest for train if already built.- Returns:
- true if print successful.
-
printManifest
Print manifest for train.- Parameters:
isPreview- True if preview.- Returns:
- true if print successful, false if train print file not found.
- Throws:
BuildFailedException- if unable to create new Manifests
-
openFile
-
runFile
-
createCsvManifestFile
-
setPrinted
-
isPrinted
Used to determine if train manifest was printed.- Returns:
- true if the train manifest was printed.
-
setTrainIconCoordinates
Sets the panel position for the train icon for the current route location.- Returns:
- true if train coordinates can be set
-
terminate
Terminate train. -
move
Move train to next location in the route. Will move engines, cars, and train icon. Will also terminate a train after it arrives at its final destination. -
move
Move train to a location in the train's route. Code checks to see if the location requested is part of the train's route and if the train hasn't already visited the location. This command can only move the train forward in its route. Note that you can not terminate the train using this command. See move() or terminate().- Parameters:
locationName- The name of the location to move this train.- Returns:
- true if train was able to move to the named location.
-
move
Moves the train to the specified route location- Parameters:
rl- route location- Returns:
- true if successful
-
moveToNextLocation
Move train to the next location in the train's route. The location name provided must be equal to the next location name in the train's route.- Parameters:
locationName- The next location name in the train's route.- Returns:
- true if successful.
-
loadTrainIcon
-
moveTrainIcon
-
getIconName
-
getLeadEngineNumber
-
getLeadEngineRoadName
-
getLeadEngineRoadAndNumber
-
getLeadEngineDccAddress
-
getLeadEngine
Gets the lead engine, will create it if the program has been restarted- Returns:
- lead engine for this train
-
setLeadEngine
-
getLeadEngine
Returns the lead engine in a train's route. There can be up to two changes in the lead engine for a train.- Parameters:
routeLocation- where in the train's route to find the lead engine.- Returns:
- lead engine
-
getTrainIcon
-
createTrainIcon
-
setSwitchListStatus
Sets the print status for switch lists- Parameters:
status- UNKNOWN PRINTED
-
getSwitchListStatus
-
reset
Resets the train, removes engines and cars from this train.- Returns:
- true if reset successful
-
checkDepartureTrack
Checks to see if the train's staging departure track has been taken by another train.- Returns:
- True if track has been allocated to another train.
-
dispose
-
store
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-trains.dtd.- Returns:
- Contents in a JDOM Element
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
setDirtyAndFirePropertyChange
-