Package jmri.jmrit.operations.trains
Class Train
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.trains.Train
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,Identifiable,PropertyChangeFirer,PropertyChangeProvider
public class Train extends PropertyChangeSupport implements Identifiable, java.beans.PropertyChangeListener
Represents a train on the layout
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>_afterBuildScriptsprotected boolean_allowCarsReturnStagingprotected boolean_allowLocalMovesprotected boolean_allowThroughCarsprotected boolean_buildprotected boolean_buildConsistprotected boolean_buildFailedprotected java.lang.String_buildFailedMessageprotected boolean_buildNormalprotected java.util.List<java.lang.String>_buildScriptsprotected boolean_builtprotected java.lang.String_builtEndYearprotected java.lang.String_builtStartYearprotected java.lang.String_cabooseRoadprotected java.util.List<java.lang.String>_cabooseRoadListprotected java.lang.String_cabooseRoadOptionprotected java.util.List<java.lang.String>_carRoadListprotected java.lang.String_carRoadOptionprotected java.lang.String_commentprotected RouteLocation_currentprotected java.util.Date_dateprotected java.lang.String_departureTimeprotected Track_departureTrackprotected java.lang.String_descriptionprotected RouteLocation_end2Legprotected java.lang.String_engineModelprotected java.lang.String_engineRoadprotected java.lang.String_idprotected Engine_leadEngineprotected java.lang.String_leadEngineIdprotected java.lang.String_leg2CabooseRoadprotected java.lang.String_leg2Enginesprotected java.lang.String_leg2Modelprotected int_leg2Optionsprotected java.lang.String_leg2Roadprotected RouteLocation_leg2Startprotected java.lang.String_leg3CabooseRoadprotected RouteLocation_leg3Endprotected java.lang.String_leg3Enginesprotected java.lang.String_leg3Modelprotected int_leg3Optionsprotected java.lang.String_leg3Roadprotected RouteLocation_leg3Start(package private) java.util.List<java.lang.String>_loadListprotected java.lang.String_loadOptionprotected java.util.List<java.lang.String>_locoRoadListprotected java.lang.String_locoRoadOptionprotected java.lang.String_logoPathNameprotected boolean_modifiedprotected java.util.List<java.lang.String>_moveScriptsprotected java.lang.String_nameprotected java.lang.String_numberEnginesprotected int_oldStatusCode(package private) java.util.List<java.lang.String>_ownerListprotected java.lang.String_ownerOptionprotected boolean_printedprotected java.lang.String_railroadNameprotected int_requiresprotected Route_routeprotected boolean_sendCarsWithCustomLoadsToStagingprotected boolean_sendToTerminalprotected boolean_serviceAllCarsWithFinalDestinationsprotected java.lang.String_serviceStatusprotected boolean_showTimes(package private) java.util.List<java.lang.String>_skipLocationsListprotected int_statusCarsRequestedprotected int_statusCodeprotected java.lang.String_switchListStatus(package private) TrainIconAnimation_taprotected java.lang.String_tableRowColorNameprotected java.lang.String_tableRowColorResetNameprotected java.util.List<java.lang.String>_terminationScriptsprotected Track_terminationTrackprotected TrainIcon_trainIcon(package private) java.util.List<java.lang.String>_typeListstatic intADD_CABOOSEstatic intADD_ENGINESstatic java.lang.StringALL_LOADSstatic java.lang.StringALL_OWNERSstatic java.lang.StringALL_ROADSstatic java.lang.StringALREADY_SERVICEDstatic java.lang.StringAUTOstatic java.lang.StringAUTO_HPTstatic java.lang.StringBUILD_CHANGED_PROPERTYstatic java.lang.StringBUILD_FAILEDstatic java.lang.StringBUILDINGstatic java.lang.StringBUILTstatic java.lang.StringBUILT_CHANGED_PROPERTYstatic java.lang.StringBUILT_YEAR_CHANGED_PROPERTYstatic intCABOOSEstatic intCHANGE_ENGINESstatic intCODE_BUILD_FAILEDstatic intCODE_BUILDINGstatic intCODE_BUILTstatic intCODE_MANIFEST_MODIFIEDstatic intCODE_PARTIAL_BUILTstatic intCODE_RUN_SCRIPTSstatic intCODE_TERMINATEDstatic intCODE_TRAIN_EN_ROUTEstatic intCODE_TRAIN_RESETstatic intCODE_UNKNOWNstatic java.lang.StringDEPARTURETIME_CHANGED_PROPERTYstatic java.lang.StringDESCRIPTION_CHANGED_PROPERTYstatic java.lang.StringDISPOSE_CHANGED_PROPERTYstatic java.lang.StringEXCLUDE_LOADSstatic java.lang.StringEXCLUDE_OWNERSstatic java.lang.StringEXCLUDE_ROADSstatic intFREDstatic intHELPER_ENGINESstatic java.lang.StringINCLUDE_LOADSstatic java.lang.StringINCLUDE_OWNERSstatic java.lang.StringINCLUDE_ROADSstatic java.lang.StringLOADS_CHANGED_PROPERTYstatic java.lang.StringMANIFEST_MODIFIEDstatic java.lang.StringNAME_CHANGED_PROPERTYstatic intNO_CABOOSE_OR_FREDstatic java.lang.StringNONEstatic java.lang.StringOWNERS_CHANGED_PROPERTYstatic java.lang.StringPARTIAL_BUILTstatic java.lang.StringPRINTEDstatic intREMOVE_CABOOSEstatic intREMOVE_ENGINESstatic java.lang.StringROADS_CHANGED_PROPERTYstatic java.lang.StringRUN_SCRIPTSprotected static java.lang.StringSEVENstatic java.lang.StringSTATUS_CHANGED_PROPERTYstatic java.lang.StringSTOPS_CHANGED_PROPERTYstatic java.lang.StringTERMINATEDstatic java.lang.StringTRAIN_CURRENT_CHANGED_PROPERTYstatic java.lang.StringTRAIN_EN_ROUTEstatic java.lang.StringTRAIN_LOCATION_CHANGED_PROPERTYstatic java.lang.StringTRAIN_MODIFIED_CHANGED_PROPERTYstatic java.lang.StringTRAIN_MOVE_COMPLETE_CHANGED_PROPERTYstatic java.lang.StringTRAIN_REQUIREMENTS_CHANGED_PROPERTYstatic java.lang.StringTRAIN_RESETstatic java.lang.StringTRAIN_ROUTE_CHANGED_PROPERTYstatic java.lang.StringTRAIN_ROW_COLOR_CHANGED_PROPERTYstatic java.lang.StringTRAIN_ROW_COLOR_RESET_CHANGED_PROPERTYstatic java.lang.StringTYPES_CHANGED_PROPERTYstatic java.lang.StringUNKNOWN-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAfterBuildScript(java.lang.String pathname)Add a script to run after a train is builtvoidaddBuildScript(java.lang.String pathname)Add a script to run before a train is builtbooleanaddCabooseRoadName(java.lang.String road)Add a caboose road name that the train will either service or exclude.booleanaddCarRoadName(java.lang.String road)Add a car road name that the train will either service or exclude.booleanaddLoadName(java.lang.String load)Add a load that the train will either service or exclude.booleanaddLocoRoadName(java.lang.String road)Add a engine road name that the train will either service or exclude.voidaddMoveScript(java.lang.String pathname)Add a script to run when train is movedbooleanaddOwnerName(java.lang.String owner)Add a owner name that the train will either service or exclude.voidaddTerminationScript(java.lang.String pathname)Add a script to run when train is terminatedvoidaddTrainSkipsLocation(RouteLocation rl)Train will skip the RouteLocationvoidaddTypeName(java.lang.String type)Add a car or engine type name that this train will service.booleanbuild()Build this train.booleanbuildIfSelected()Build this train if the build control flag is true.booleancheckDepartureTrack()Checks to see if the train's staging departure track has been taken by another train.java.io.FilecreateCsvManifestFile()voidcreateTrainIcon(RouteLocation rl)voiddeleteAfterBuildScript(java.lang.String pathname)voiddeleteBuildScript(java.lang.String pathname)booleandeleteCabooseRoadName(java.lang.String road)Delete a caboose road name that the train will either service or exclude.booleandeleteCarRoadName(java.lang.String road)Delete a car road name that the train will either service or exclude.booleandeleteLoadName(java.lang.String load)Delete a load name that the train will either service or exclude.booleandeleteLocoRoadName(java.lang.String road)Delete a engine road name that the train will either service or exclude.voiddeleteMoveScript(java.lang.String pathname)booleandeleteOwnerName(java.lang.String owner)Delete a owner name that the train will either service or exclude.voiddeleteTerminationScript(java.lang.String pathname)voiddeleteTrainSkipsLocation(RouteLocation rl)voiddeleteTypeName(java.lang.String type)voiddispose()java.util.List<java.lang.String>getAfterBuildScripts()Gets a list of pathnames (scripts) to run after this train is builtprotected java.lang.StringgetBuildFailedMessage()java.util.List<java.lang.String>getBuildScripts()Gets a list of pathnames (scripts) to run before this train is builtjava.lang.StringgetBuiltEndYear()java.lang.StringgetBuiltStartYear()java.lang.StringgetCabooseRoad()java.lang.StringgetCabooseRoadAndNumber()Gets the current caboose road and number if there's one assigned to the train.java.lang.String[]getCabooseRoadNames()Provides a list of caboose road names that the train will either service or exclude.java.lang.StringgetCabooseRoadOption()Get how this train deals with caboose road names.java.lang.String[]getCarRoadNames()Provides a list of car road names that the train will either service or exclude.java.lang.StringgetCarRoadOption()Get how this train deals with car road names.java.lang.String[]getCarTypeNames()java.lang.StringgetComment()java.lang.StringgetCommentWithColor()java.lang.StringgetCurrentLocationName()Get train's current location nameRouteLocationgetCurrentRouteLocation()Get train's current route locationjava.lang.StringgetDate()intgetDepartTimeMinutes()Get train's departure time in minutes from midnight for sortingjava.lang.StringgetDepartureTime()Get's train's departure timejava.lang.StringgetDepartureTimeHour()java.lang.StringgetDepartureTimeMinute()TrackgetDepartureTrack()java.lang.StringgetDescription()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.java.lang.StringgetEngineModel()java.lang.StringgetEngineRoad()Get the road name of engines servicing this train.java.lang.StringgetExpectedArrivalTime(RouteLocation routeLocation)Gets the expected time when this train will arrive at the location rl.java.lang.StringgetExpectedArrivalTime(RouteLocation routeLocation, boolean isSortFormat)java.lang.StringgetExpectedDepartureTime(RouteLocation routeLocation)java.lang.StringgetExpectedDepartureTime(RouteLocation routeLocation, boolean isSortFormat)intgetExpectedTravelTimeInMinutes(RouteLocation routeLocation)Used to determine when a train will arrive at a train's route location.java.lang.StringgetFormatedDepartureTime()Get's train's departure time in 12hr or 24hr formatjava.lang.StringgetIconName()java.lang.StringgetId()Get the identity of the object.EnginegetLeadEngine()Gets the lead engine, will create it if the program has been restartedEnginegetLeadEngine(RouteLocation routeLocation)Returns the lead engine in a train's route.java.lang.StringgetLeadEngineDccAddress()java.lang.StringgetLeadEngineNumber()java.lang.StringgetLeadEngineRoadAndNumber()java.lang.StringgetLeadEngineRoadName()java.lang.String[]getLoadNames()Provides a list of loads that the train will either service or exclude.java.lang.StringgetLoadOption()Gets the car load option for this train.java.lang.String[]getLocoRoadNames()Provides a list of engine road names that the train will either service or exclude.java.lang.StringgetLocoRoadOption()Get how this train deals with locomotive road names.java.lang.String[]getLocoTypeNames()java.lang.StringgetManifestLogoPathName()java.util.List<java.lang.String>getMoveScripts()Gets a list of pathnames (scripts) to run when this train movedjava.lang.StringgetMRStatus()java.lang.StringgetName()Get's a train's namejava.lang.StringgetNextLocationName()Get the train's next location namejava.lang.StringgetNextLocationName(int number)Get a location name in a train's route from the current train's location.RouteLocationgetNextRouteLocation(RouteLocation currentRouteLocation)intgetNumberCarsInTrain()Gets 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.intgetNumberCarsPickedUp()intgetNumberCarsPickedUp(RouteLocation routeLocation)Gets the number of cars pulled from a locationintgetNumberCarsRequested()intgetNumberCarsSetout()intgetNumberCarsSetout(RouteLocation routeLocation)Gets the number of cars delivered to a locationintgetNumberCarsWorked()intgetNumberEmptyCarsInTrain(RouteLocation routeLocation)Gets the number of empty cars in the train when train departs the route location.java.lang.StringgetNumberEngines()Get the number of engines that this train requires.intgetNumberLoadedCarsInTrain(RouteLocation routeLocation)protected intgetOldStatusCode()java.lang.String[]getOwnerNames()Provides a list of owner names that the train will either service or exclude.java.lang.StringgetOwnerOption()java.lang.StringgetRailroadName()Gets the optional railroad name for this train.java.lang.StringgetRawDescription()intgetRequirements()Get a train's requirements with regards to the last car in the train.RoutegetRoute()Gets the train's routejava.lang.StringgetSecondLegCabooseRoad()java.lang.StringgetSecondLegEndLocationName()RouteLocationgetSecondLegEndRouteLocation()java.lang.StringgetSecondLegEngineModel()java.lang.StringgetSecondLegEngineRoad()Get the road name of engines servicing this train 2nd leg.java.lang.StringgetSecondLegNumberEngines()Get the number of engines needed for the second set.intgetSecondLegOptions()java.lang.StringgetSecondLegStartLocationName()RouteLocationgetSecondLegStartRouteLocation()java.lang.StringgetServiceStatus()Returns the statusCode of the "isServiceable(Car)" routine.java.lang.StringgetSortDate()java.lang.StringgetSplitName()java.lang.StringgetStatus()Get train's status in the default locale.java.lang.StringgetStatus(java.util.Locale locale)Get train's status in the specified locale.java.lang.StringgetStatus(java.util.Locale locale, int code)Get the human-readable status for the requested status code.intgetStatusCode()java.lang.StringgetSwitchListStatus()java.awt.ColorgetTableRowColor()java.lang.StringgetTableRowColorName()java.lang.StringgetTableRowColorNameReset()java.util.List<java.lang.String>getTerminationScripts()Gets a list of pathnames (scripts) to run when this train terminatesTrackgetTerminationTrack()java.lang.StringgetThirdLegCabooseRoad()java.lang.StringgetThirdLegEndLocationName()RouteLocationgetThirdLegEndRouteLocation()java.lang.StringgetThirdLegEngineModel()java.lang.StringgetThirdLegEngineRoad()Get the road name of engines servicing this train 3rd leg.java.lang.StringgetThirdLegNumberEngines()Get the number of engines needed for the third set.intgetThirdLegOptions()java.lang.StringgetThirdLegStartLocationName()RouteLocationgetThirdLegStartRouteLocation()java.util.List<RouteLocation>getTrainBlockingOrder()Returns the order the train should be blocked.java.lang.StringgetTrainDepartsDirection()java.lang.StringgetTrainDepartsName()Get the train's departure location's nameRouteLocationgetTrainDepartsRouteLocation()intgetTrainHorsePower(RouteLocation routeLocation)Gets the train's locomotive horsepower at the route location specifiedTrainIcongetTrainIcon()intgetTrainLength()Gets 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 specifiedjava.lang.StringgetTrainRouteName()Get's the train's route name.protected java.lang.String[]getTrainSkipsLocations()java.lang.StringgetTrainTerminatesName()Get train's final location's nameRouteLocationgetTrainTerminatesRouteLocation()intgetTrainWeight()Get the train's weight at the current location.intgetTrainWeight(RouteLocation routeLocation)java.lang.String[]getTypeNames()Get's the type names of rolling stock this train will serviceintgetWorkTimeAtLocation(RouteLocation routeLocation)booleanisAllowLocalMovesEnabled()Allow local moves if car has a custom load or Final DestinationbooleanisAllowReturnToStagingEnabled()When true allow a turn to return cars to staging.booleanisAllowThroughCarsEnabled()booleanisBuildConsistEnabled()booleanisBuildEnabled()Used to determine if train is to be built.booleanisBuildFailed()Returns true if the train build failed.booleanisBuildTrainNormalEnabled()booleanisBuilt()Used to determine if this train has been built.booleanisBuiltDateAccepted(java.lang.String date)Determine if train will service rolling stock by built date.booleanisCabooseNeeded()booleanisCabooseRoadNameAccepted(java.lang.String road)Determine if train will service a specific road name for a caboose.booleanisCarRoadNameAccepted(java.lang.String road)Determine if train will service a specific road name for a car.booleanisDepartingStaging()booleanisFredNeeded()booleanisLoadNameAccepted(java.lang.String load)Determine if train will service a specific load name.booleanisLoadNameAccepted(java.lang.String load, java.lang.String type)Determine if train will service a specific load and car type.booleanisLocalSwitcher()Used to determine if train is a local switcher serving one location.booleanisLocationSkipped(RouteLocation rl)Determines if this train skips a location (doesn't service the location).booleanisLocoRoadNameAccepted(java.lang.String road)Determine if train will service a specific road name for an engine.booleanisModified()booleanisOnlyPassengerCars()Used to determine if train is carrying only passenger cars.booleanisOwnerNameAccepted(java.lang.String owner)Determine if train will service a specific owner name.booleanisPrinted()Used to determine if train manifest was printed.booleanisSendCarsToTerminalEnabled()booleanisSendCarsWithCustomLoadsToStagingEnabled()booleanisServiceable(java.io.PrintWriter buildReport, Car car)Note that this code was written after TrainBuilder.booleanisServiceable(Car car)Determines if this train will service this car.booleanisServiceAllCarsWithFinalDestinationsEnabled()booleanisShowArrivalAndDepartureTimesEnabled()booleanisTrainEnRoute()Used to determine if train has departed the first location in the train's routebooleanisTurn()booleanisTypeNameAccepted(java.lang.String type)Returns true if this train will service the type of car or engine.voidloadTrainIcon()voidmove()Move train to next location in the route.booleanmove(java.lang.String locationName)Move train to a location in the train's route.booleanmove(RouteLocation rl)Moves the train to the specified route locationbooleanmoveToNextLocation(java.lang.String locationName)Move train to the next location in the train's route.voidmoveTrainIcon(RouteLocation rl)booleanopenFile()booleanprintBuildReport()booleanprintBuildReport(boolean isPreview)booleanprintManifest(boolean isPreview)Print manifest for train.booleanprintManifestIfBuilt()Print manifest for train if already built.voidpropertyChange(java.beans.PropertyChangeEvent e)protected voidreplaceModel(java.lang.String oldModel, java.lang.String newModel)protected voidreplaceOwner(java.lang.String oldName, java.lang.String newName)protected voidreplaceRoad(java.lang.String oldRoad, java.lang.String newRoad)protected voidreplaceType(java.lang.String oldType, java.lang.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(java.lang.String message)voidsetBuildTrainNormalEnabled(boolean enable)voidsetBuilt(boolean built)voidsetBuiltEndYear(java.lang.String year)Only rolling stock built in or before this year will be used.voidsetBuiltStartYear(java.lang.String year)Only rolling stock built in or after this year will be used.voidsetCabooseRoad(java.lang.String road)Set the road name of the caboose servicing this train.protected voidsetCabooseRoadNames(java.lang.String[] roads)voidsetCabooseRoadOption(java.lang.String option)Set how this train deals with caboose road names.voidsetCarRoadNames(java.lang.String[] roads)voidsetCarRoadOption(java.lang.String option)Set how this train deals with car road names.voidsetComment(java.lang.String comment)voidsetCurrentLocation(RouteLocation location)Set train's current route locationvoidsetDate(java.util.Date date)voidsetDepartureTime(java.lang.String hour, java.lang.String minute)voidsetDepartureTrack(Track track)voidsetDescription(java.lang.String description)protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidsetEngineModel(java.lang.String model)Set the model name of engines servicing this train.voidsetEngineRoad(java.lang.String road)Set the road name of engines servicing this train.voidsetLeadEngine(Engine engine)voidsetLoadNames(java.lang.String[] loads)voidsetLoadOption(java.lang.String option)Set how this train deals with car loadsvoidsetLocoRoadNames(java.lang.String[] roads)voidsetLocoRoadOption(java.lang.String option)Set how this train deals with locomotive road names.voidsetManifestLogoPathName(java.lang.String pathName)Overrides the default logo for this train.voidsetModified(boolean modified)Set true whenever the train's manifest has been modified.voidsetName(java.lang.String name)Sets the name of this train, normally a short name that can fit within the train icon.voidsetNumberCarsRequested(int number)voidsetNumberEngines(java.lang.String number)protected voidsetOldStatusCode(int code)voidsetOwnerNames(java.lang.String[] owners)voidsetOwnerOption(java.lang.String option)Set how this train deals with car owner namesvoidsetPrinted(boolean printed)voidsetRailroadName(java.lang.String name)Overrides the default railroad name for this train.voidsetRequirements(int requires)Set train requirements.voidsetRoute(Route route)voidsetSecondLegCabooseRoad(java.lang.String road)Set the road name of the second leg caboose servicing this train.voidsetSecondLegEndRouteLocation(RouteLocation rl)voidsetSecondLegEngineModel(java.lang.String model)Set the model name of engines servicing this train's 2nd leg.voidsetSecondLegEngineRoad(java.lang.String road)Set the road name of engines servicing this train 2nd leg.voidsetSecondLegNumberEngines(java.lang.String number)voidsetSecondLegOptions(int options)Optional changes to train while en route.voidsetSecondLegStartRouteLocation(RouteLocation rl)voidsetSendCarsToTerminalEnabled(boolean enable)voidsetSendCarsWithCustomLoadsToStagingEnabled(boolean enable)voidsetServiceAllCarsWithFinalDestinationsEnabled(boolean enable)protected voidsetServiceStatus(java.lang.String status)voidsetShowArrivalAndDepartureTimes(boolean enable)voidsetStatusCode(int code)Set the train's machine readable status.voidsetSwitchListStatus(java.lang.String status)Sets the print status for switch listsvoidsetTableRowColorName(java.lang.String colorName)voidsetTableRowColorNameReset(java.lang.String colorName)voidsetTerminationTrack(Track track)voidsetThirdLegCabooseRoad(java.lang.String road)Set the road name of the third leg caboose servicing this train.voidsetThirdLegEndRouteLocation(RouteLocation rl)voidsetThirdLegEngineModel(java.lang.String model)Set the model name of engines servicing this train's 3rd leg.voidsetThirdLegEngineRoad(java.lang.String road)Set the road name of engines servicing this train 3rd leg.voidsetThirdLegNumberEngines(java.lang.String number)voidsetThirdLegOptions(int options)Optional changes to train while en route.voidsetThirdLegStartRouteLocation(RouteLocation rl)booleansetTrainIconCoordinates()Sets the panel position for the train icon for the current route location.protected voidsetTrainSkipsLocations(java.lang.String[] locationIds)protected voidsetTypeNames(java.lang.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()Terminate train.java.lang.StringtoString()Get's a train's namevoidupdateTrainTableRowColor()-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
NONE
public static final java.lang.String NONE
- See Also:
- Constant Field Values
-
_id
protected java.lang.String _id
-
_name
protected java.lang.String _name
-
_description
protected java.lang.String _description
-
_current
protected RouteLocation _current
-
_buildFailedMessage
protected java.lang.String _buildFailedMessage
-
_built
protected boolean _built
-
_modified
protected boolean _modified
-
_build
protected boolean _build
-
_buildFailed
protected boolean _buildFailed
-
_printed
protected boolean _printed
-
_sendToTerminal
protected boolean _sendToTerminal
-
_allowLocalMoves
protected boolean _allowLocalMoves
-
_allowThroughCars
protected boolean _allowThroughCars
-
_buildNormal
protected boolean _buildNormal
-
_allowCarsReturnStaging
protected boolean _allowCarsReturnStaging
-
_serviceAllCarsWithFinalDestinations
protected boolean _serviceAllCarsWithFinalDestinations
-
_buildConsist
protected boolean _buildConsist
-
_sendCarsWithCustomLoadsToStaging
protected boolean _sendCarsWithCustomLoadsToStaging
-
_departureTrack
protected Track _departureTrack
-
_terminationTrack
protected Track _terminationTrack
-
_carRoadOption
protected java.lang.String _carRoadOption
-
_carRoadList
protected java.util.List<java.lang.String> _carRoadList
-
_cabooseRoadOption
protected java.lang.String _cabooseRoadOption
-
_cabooseRoadList
protected java.util.List<java.lang.String> _cabooseRoadList
-
_locoRoadOption
protected java.lang.String _locoRoadOption
-
_locoRoadList
protected java.util.List<java.lang.String> _locoRoadList
-
_requires
protected int _requires
-
_numberEngines
protected java.lang.String _numberEngines
-
_engineRoad
protected java.lang.String _engineRoad
-
_engineModel
protected java.lang.String _engineModel
-
_cabooseRoad
protected java.lang.String _cabooseRoad
-
_departureTime
protected java.lang.String _departureTime
-
_leadEngineId
protected java.lang.String _leadEngineId
-
_builtStartYear
protected java.lang.String _builtStartYear
-
_builtEndYear
protected java.lang.String _builtEndYear
-
_loadOption
protected java.lang.String _loadOption
-
_ownerOption
protected java.lang.String _ownerOption
-
_buildScripts
protected java.util.List<java.lang.String> _buildScripts
-
_afterBuildScripts
protected java.util.List<java.lang.String> _afterBuildScripts
-
_moveScripts
protected java.util.List<java.lang.String> _moveScripts
-
_terminationScripts
protected java.util.List<java.lang.String> _terminationScripts
-
_railroadName
protected java.lang.String _railroadName
-
_logoPathName
protected java.lang.String _logoPathName
-
_showTimes
protected boolean _showTimes
-
_leadEngine
protected Engine _leadEngine
-
_switchListStatus
protected java.lang.String _switchListStatus
-
_comment
protected java.lang.String _comment
-
_serviceStatus
protected java.lang.String _serviceStatus
-
_statusCode
protected int _statusCode
-
_oldStatusCode
protected int _oldStatusCode
-
_date
protected java.util.Date _date
-
_statusCarsRequested
protected int _statusCarsRequested
-
_tableRowColorName
protected java.lang.String _tableRowColorName
-
_tableRowColorResetName
protected java.lang.String _tableRowColorResetName
-
_leg2Options
protected int _leg2Options
-
_leg2Start
protected RouteLocation _leg2Start
-
_end2Leg
protected RouteLocation _end2Leg
-
_leg2Engines
protected java.lang.String _leg2Engines
-
_leg2Road
protected java.lang.String _leg2Road
-
_leg2Model
protected java.lang.String _leg2Model
-
_leg2CabooseRoad
protected java.lang.String _leg2CabooseRoad
-
_leg3Options
protected int _leg3Options
-
_leg3Start
protected RouteLocation _leg3Start
-
_leg3End
protected RouteLocation _leg3End
-
_leg3Engines
protected java.lang.String _leg3Engines
-
_leg3Road
protected java.lang.String _leg3Road
-
_leg3Model
protected java.lang.String _leg3Model
-
_leg3CabooseRoad
protected java.lang.String _leg3CabooseRoad
-
CHANGE_ENGINES
public static final int CHANGE_ENGINES
- See Also:
- Constant Field Values
-
HELPER_ENGINES
public static final int HELPER_ENGINES
- See Also:
- Constant Field Values
-
ADD_CABOOSE
public static final int ADD_CABOOSE
- See Also:
- Constant Field Values
-
REMOVE_CABOOSE
public static final int REMOVE_CABOOSE
- See Also:
- Constant Field Values
-
ADD_ENGINES
public static final int ADD_ENGINES
- See Also:
- Constant Field Values
-
REMOVE_ENGINES
public static final int REMOVE_ENGINES
- See Also:
- Constant Field Values
-
DISPOSE_CHANGED_PROPERTY
public static final java.lang.String DISPOSE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
STOPS_CHANGED_PROPERTY
public static final java.lang.String STOPS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TYPES_CHANGED_PROPERTY
public static final java.lang.String TYPES_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
BUILT_CHANGED_PROPERTY
public static final java.lang.String BUILT_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
BUILT_YEAR_CHANGED_PROPERTY
public static final java.lang.String BUILT_YEAR_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
BUILD_CHANGED_PROPERTY
public static final java.lang.String BUILD_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
ROADS_CHANGED_PROPERTY
public static final java.lang.String ROADS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOADS_CHANGED_PROPERTY
public static final java.lang.String LOADS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
OWNERS_CHANGED_PROPERTY
public static final java.lang.String OWNERS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
NAME_CHANGED_PROPERTY
public static final java.lang.String NAME_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DESCRIPTION_CHANGED_PROPERTY
public static final java.lang.String DESCRIPTION_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
STATUS_CHANGED_PROPERTY
public static final java.lang.String STATUS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DEPARTURETIME_CHANGED_PROPERTY
public static final java.lang.String DEPARTURETIME_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_LOCATION_CHANGED_PROPERTY
public static final java.lang.String TRAIN_LOCATION_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_ROUTE_CHANGED_PROPERTY
public static final java.lang.String TRAIN_ROUTE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_REQUIREMENTS_CHANGED_PROPERTY
public static final java.lang.String TRAIN_REQUIREMENTS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_MOVE_COMPLETE_CHANGED_PROPERTY
public static final java.lang.String TRAIN_MOVE_COMPLETE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_ROW_COLOR_CHANGED_PROPERTY
public static final java.lang.String TRAIN_ROW_COLOR_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_ROW_COLOR_RESET_CHANGED_PROPERTY
public static final java.lang.String TRAIN_ROW_COLOR_RESET_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_MODIFIED_CHANGED_PROPERTY
public static final java.lang.String TRAIN_MODIFIED_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_CURRENT_CHANGED_PROPERTY
public static final java.lang.String TRAIN_CURRENT_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_RESET
public static final java.lang.String TRAIN_RESET
-
RUN_SCRIPTS
public static final java.lang.String RUN_SCRIPTS
-
BUILDING
public static final java.lang.String BUILDING
-
BUILD_FAILED
public static final java.lang.String BUILD_FAILED
-
BUILT
public static final java.lang.String BUILT
-
PARTIAL_BUILT
public static final java.lang.String PARTIAL_BUILT
-
TRAIN_EN_ROUTE
public static final java.lang.String TRAIN_EN_ROUTE
-
TERMINATED
public static final java.lang.String TERMINATED
-
MANIFEST_MODIFIED
public static final java.lang.String MANIFEST_MODIFIED
-
CODE_TRAIN_RESET
public static final int CODE_TRAIN_RESET
- See Also:
- Constant Field Values
-
CODE_RUN_SCRIPTS
public static final int CODE_RUN_SCRIPTS
- See Also:
- Constant Field Values
-
CODE_BUILDING
public static final int CODE_BUILDING
- See Also:
- Constant Field Values
-
CODE_BUILD_FAILED
public static final int CODE_BUILD_FAILED
- See Also:
- Constant Field Values
-
CODE_BUILT
public static final int CODE_BUILT
- See Also:
- Constant Field Values
-
CODE_PARTIAL_BUILT
public static final int CODE_PARTIAL_BUILT
- See Also:
- Constant Field Values
-
CODE_TRAIN_EN_ROUTE
public static final int CODE_TRAIN_EN_ROUTE
- See Also:
- Constant Field Values
-
CODE_TERMINATED
public static final int CODE_TERMINATED
- See Also:
- Constant Field Values
-
CODE_MANIFEST_MODIFIED
public static final int CODE_MANIFEST_MODIFIED
- See Also:
- Constant Field Values
-
CODE_UNKNOWN
public static final int CODE_UNKNOWN
- See Also:
- Constant Field Values
-
NO_CABOOSE_OR_FRED
public static final int NO_CABOOSE_OR_FRED
- See Also:
- Constant Field Values
-
CABOOSE
public static final int CABOOSE
- See Also:
- Constant Field Values
-
FRED
public static final int FRED
- See Also:
- Constant Field Values
-
ALL_ROADS
public static final java.lang.String ALL_ROADS
-
INCLUDE_ROADS
public static final java.lang.String INCLUDE_ROADS
-
EXCLUDE_ROADS
public static final java.lang.String EXCLUDE_ROADS
-
ALL_OWNERS
public static final java.lang.String ALL_OWNERS
-
INCLUDE_OWNERS
public static final java.lang.String INCLUDE_OWNERS
-
EXCLUDE_OWNERS
public static final java.lang.String EXCLUDE_OWNERS
-
ALL_LOADS
public static final java.lang.String ALL_LOADS
-
INCLUDE_LOADS
public static final java.lang.String INCLUDE_LOADS
-
EXCLUDE_LOADS
public static final java.lang.String EXCLUDE_LOADS
-
UNKNOWN
public static final java.lang.String UNKNOWN
- See Also:
- Constant Field Values
-
PRINTED
public static final java.lang.String PRINTED
-
AUTO
public static final java.lang.String AUTO
-
AUTO_HPT
public static final java.lang.String AUTO_HPT
-
ALREADY_SERVICED
public static final java.lang.String ALREADY_SERVICED
- See Also:
- Constant Field Values
-
_skipLocationsList
java.util.List<java.lang.String> _skipLocationsList
-
_typeList
java.util.List<java.lang.String> _typeList
-
_loadList
java.util.List<java.lang.String> _loadList
-
_ownerList
java.util.List<java.lang.String> _ownerList
-
SEVEN
protected static final java.lang.String SEVEN
- See Also:
- Constant Field Values
-
_trainIcon
protected TrainIcon _trainIcon
-
-
Method Detail
-
getId
public java.lang.String getId()
Description copied from interface:IdentifiableGet the identity of the object.- Specified by:
getIdin interfaceIdentifiable- Returns:
- the identity
-
setName
public void setName(java.lang.String name)
Sets the name of this train, normally a short name that can fit within the train icon.- Parameters:
name- the train's name.
-
toString
public java.lang.String toString()
Get's a train's name- Overrides:
toStringin classjava.lang.Object- Returns:
- train's name
-
getName
public java.lang.String getName()
Get's a train's name- Returns:
- train's name
-
getSplitName
public java.lang.String getSplitName()
-
getTableRowColorName
public java.lang.String getTableRowColorName()
- Returns:
- The name of the color when highlighting the train's row
-
setTableRowColorName
public void setTableRowColorName(java.lang.String colorName)
-
getTableRowColorNameReset
public java.lang.String getTableRowColorNameReset()
- Returns:
- The name of the train row color when the train is reset
-
setTableRowColorNameReset
public void setTableRowColorNameReset(java.lang.String colorName)
-
getTableRowColor
public java.awt.Color getTableRowColor()
- Returns:
- The color when highlighting the train's row
-
getDepartureTime
public java.lang.String getDepartureTime()
Get's train's departure time- Returns:
- train's departure time in the String format hh:mm
-
getFormatedDepartureTime
public java.lang.String 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
public int getDepartTimeMinutes()
Get train's departure time in minutes from midnight for sorting- Returns:
- int hh*60+mm
-
setDepartureTime
public void setDepartureTime(java.lang.String hour, java.lang.String minute)
-
getDepartureTimeHour
public java.lang.String getDepartureTimeHour()
-
getDepartureTimeMinute
public java.lang.String getDepartureTimeMinute()
-
getExpectedArrivalTime
public java.lang.String getExpectedArrivalTime(RouteLocation routeLocation)
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
public java.lang.String getExpectedArrivalTime(RouteLocation routeLocation, boolean isSortFormat)
-
getExpectedDepartureTime
public java.lang.String getExpectedDepartureTime(RouteLocation routeLocation)
-
getExpectedDepartureTime
public java.lang.String getExpectedDepartureTime(RouteLocation routeLocation, boolean isSortFormat)
-
getWorkTimeAtLocation
public int getWorkTimeAtLocation(RouteLocation routeLocation)
-
getExpectedTravelTimeInMinutes
public int getExpectedTravelTimeInMinutes(RouteLocation routeLocation)
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
public void setRequirements(int requires)
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
public int getRequirements()
Get a train's requirements with regards to the last car in the train.- Returns:
- NONE CABOOSE FRED
-
isCabooseNeeded
public boolean isCabooseNeeded()
-
isFredNeeded
public boolean isFredNeeded()
-
getTrainRouteName
public java.lang.String getTrainRouteName()
Get's the train's route name.- Returns:
- Train's route name.
-
getTrainDepartsName
public java.lang.String getTrainDepartsName()
Get the train's departure location's name- Returns:
- train's departure location's name
-
getTrainDepartsRouteLocation
public RouteLocation getTrainDepartsRouteLocation()
-
getTrainDepartsDirection
public java.lang.String getTrainDepartsDirection()
-
getTrainTerminatesName
public java.lang.String getTrainTerminatesName()
Get train's final location's name- Returns:
- train's final location's name
-
getTrainTerminatesRouteLocation
public RouteLocation getTrainTerminatesRouteLocation()
-
getTrainBlockingOrder
public java.util.List<RouteLocation> getTrainBlockingOrder()
Returns the order the train should be blocked.- Returns:
- routeLocations for this train.
-
setCurrentLocation
public void setCurrentLocation(RouteLocation location)
Set train's current route location- Parameters:
location- The current RouteLocation.
-
getCurrentLocationName
public java.lang.String getCurrentLocationName()
Get train's current location name- Returns:
- Train's current route location name
-
getCurrentRouteLocation
public RouteLocation getCurrentRouteLocation()
Get train's current route location- Returns:
- Train's current route location
-
getNextLocationName
public java.lang.String getNextLocationName()
Get the train's next location name- Returns:
- Train's next route location name
-
getNextLocationName
public java.lang.String getNextLocationName(int number)
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
public RouteLocation getNextRouteLocation(RouteLocation currentRouteLocation)
-
setDepartureTrack
public void setDepartureTrack(Track track)
-
getDepartureTrack
public Track getDepartureTrack()
-
isDepartingStaging
public boolean isDepartingStaging()
-
setTerminationTrack
public void setTerminationTrack(Track track)
-
getTerminationTrack
public Track getTerminationTrack()
-
setStatusCode
public void setStatusCode(int code)
Set the train's machine readable status. Calls update train table row color.- Parameters:
code- machine readable
-
updateTrainTableRowColor
public void updateTrainTableRowColor()
-
getStatus
public java.lang.String getStatus()
Get train's status in the default locale.- Returns:
- Human-readable status
-
getStatus
public java.lang.String getStatus(java.util.Locale locale)
Get train's status in the specified locale.- Parameters:
locale- The Locale.- Returns:
- Human-readable status
-
getStatus
public java.lang.String getStatus(java.util.Locale locale, int code)
Get the human-readable status for the requested status code.- Parameters:
locale- The Locale.code- requested status- Returns:
- Human-readable status
-
getMRStatus
public java.lang.String getMRStatus()
-
getStatusCode
public int getStatusCode()
-
setOldStatusCode
protected void setOldStatusCode(int code)
-
getOldStatusCode
protected int getOldStatusCode()
-
isTrainEnRoute
public boolean isTrainEnRoute()
Used to determine if train has departed the first location in the train's route- Returns:
- true if train has departed
-
isLocalSwitcher
public boolean 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
public boolean isTurn()
-
isOnlyPassengerCars
public boolean isOnlyPassengerCars()
Used to determine if train is carrying only passenger cars.- Returns:
- true if only passenger cars have been assigned to this train.
-
getTrainSkipsLocations
protected java.lang.String[] getTrainSkipsLocations()
-
setTrainSkipsLocations
protected void setTrainSkipsLocations(java.lang.String[] locationIds)
-
addTrainSkipsLocation
public void addTrainSkipsLocation(RouteLocation rl)
Train will skip the RouteLocation- Parameters:
rl- RouteLocation
-
deleteTrainSkipsLocation
public void deleteTrainSkipsLocation(RouteLocation rl)
-
isLocationSkipped
public boolean isLocationSkipped(RouteLocation rl)
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
public java.lang.String[] getTypeNames()
Get's the type names of rolling stock this train will service- Returns:
- The type names for cars and or engines
-
getCarTypeNames
public java.lang.String[] getCarTypeNames()
-
getLocoTypeNames
public java.lang.String[] getLocoTypeNames()
-
setTypeNames
protected void setTypeNames(java.lang.String[] types)
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
public void addTypeName(java.lang.String type)
Add a car or engine type name that this train will service.- Parameters:
type- The new type name to service.
-
deleteTypeName
public void deleteTypeName(java.lang.String type)
-
isTypeNameAccepted
public boolean isTypeNameAccepted(java.lang.String type)
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
protected void replaceType(java.lang.String oldType, java.lang.String newType)
-
getCarRoadOption
public java.lang.String getCarRoadOption()
Get how this train deals with car road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCarRoadOption
public void setCarRoadOption(java.lang.String option)
Set how this train deals with car road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCarRoadNames
public void setCarRoadNames(java.lang.String[] roads)
-
getCarRoadNames
public java.lang.String[] 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
public boolean addCarRoadName(java.lang.String road)
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
public boolean deleteCarRoadName(java.lang.String road)
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
public boolean isCarRoadNameAccepted(java.lang.String road)
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
public java.lang.String getCabooseRoadOption()
Get how this train deals with caboose road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCabooseRoadOption
public void setCabooseRoadOption(java.lang.String option)
Set how this train deals with caboose road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setCabooseRoadNames
protected void setCabooseRoadNames(java.lang.String[] roads)
-
getCabooseRoadNames
public java.lang.String[] 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
public boolean addCabooseRoadName(java.lang.String road)
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
public boolean deleteCabooseRoadName(java.lang.String road)
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
public boolean isCabooseRoadNameAccepted(java.lang.String road)
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
public java.lang.String getLocoRoadOption()
Get how this train deals with locomotive road names.- Returns:
- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setLocoRoadOption
public void setLocoRoadOption(java.lang.String option)
Set how this train deals with locomotive road names.- Parameters:
option- ALL_ROADS INCLUDE_ROADS EXCLUDE_ROADS
-
setLocoRoadNames
public void setLocoRoadNames(java.lang.String[] roads)
-
getLocoRoadNames
public java.lang.String[] 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
public boolean addLocoRoadName(java.lang.String road)
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
public boolean deleteLocoRoadName(java.lang.String road)
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
public boolean isLocoRoadNameAccepted(java.lang.String road)
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
protected void replaceRoad(java.lang.String oldRoad, java.lang.String newRoad)
-
getLoadOption
public java.lang.String getLoadOption()
Gets the car load option for this train.- Returns:
- ALL_LOADS INCLUDE_LOADS EXCLUDE_LOADS
-
setLoadOption
public void setLoadOption(java.lang.String option)
Set how this train deals with car loads- Parameters:
option- ALL_LOADS INCLUDE_LOADS EXCLUDE_LOADS
-
setLoadNames
public void setLoadNames(java.lang.String[] loads)
-
getLoadNames
public java.lang.String[] getLoadNames()
Provides a list of loads that the train will either service or exclude. See setLoadOption- Returns:
- Array of load names as Strings
-
addLoadName
public boolean addLoadName(java.lang.String load)
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
public boolean deleteLoadName(java.lang.String load)
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
public boolean isLoadNameAccepted(java.lang.String load)
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
public boolean isLoadNameAccepted(java.lang.String load, java.lang.String type)
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
public java.lang.String getOwnerOption()
-
setOwnerOption
public void setOwnerOption(java.lang.String option)
Set how this train deals with car owner names- Parameters:
option- ALL_OWNERS INCLUDE_OWNERS EXCLUDE_OWNERS
-
setOwnerNames
public void setOwnerNames(java.lang.String[] owners)
-
getOwnerNames
public java.lang.String[] 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
public boolean addOwnerName(java.lang.String owner)
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
public boolean deleteOwnerName(java.lang.String owner)
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
public boolean isOwnerNameAccepted(java.lang.String owner)
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
protected void replaceOwner(java.lang.String oldName, java.lang.String newName)
-
setBuiltStartYear
public void setBuiltStartYear(java.lang.String year)
Only rolling stock built in or after this year will be used.- Parameters:
year- A string representing a year.
-
getBuiltStartYear
public java.lang.String getBuiltStartYear()
-
setBuiltEndYear
public void setBuiltEndYear(java.lang.String year)
Only rolling stock built in or before this year will be used.- Parameters:
year- A string representing a year.
-
getBuiltEndYear
public java.lang.String getBuiltEndYear()
-
isBuiltDateAccepted
public boolean isBuiltDateAccepted(java.lang.String date)
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
public boolean isServiceable(Car car)
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
public boolean isServiceable(java.io.PrintWriter buildReport, Car car)
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.
-
setServiceStatus
protected void setServiceStatus(java.lang.String status)
-
getServiceStatus
public java.lang.String 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
public int getNumberCarsWorked()
- Returns:
- The number of cars worked by this train
-
setNumberCarsRequested
public void setNumberCarsRequested(int number)
-
getNumberCarsRequested
public int getNumberCarsRequested()
-
setDate
public void setDate(java.util.Date date)
-
getSortDate
public java.lang.String getSortDate()
-
getDate
public java.lang.String getDate()
-
getNumberCarsInTrain
public int 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
public int getNumberCarsInTrain(RouteLocation routeLocation)
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
public int getNumberEmptyCarsInTrain(RouteLocation routeLocation)
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
public int getNumberLoadedCarsInTrain(RouteLocation routeLocation)
-
getNumberCarsPickedUp
public int getNumberCarsPickedUp()
-
getNumberCarsPickedUp
public int getNumberCarsPickedUp(RouteLocation routeLocation)
Gets the number of cars pulled from a location- Parameters:
routeLocation- the location- Returns:
- number of pick ups
-
getNumberCarsSetout
public int getNumberCarsSetout()
-
getNumberCarsSetout
public int getNumberCarsSetout(RouteLocation routeLocation)
Gets the number of cars delivered to a location- Parameters:
routeLocation- the location- Returns:
- number of set outs
-
getTrainLength
public int 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
public int getTrainLength(RouteLocation routeLocation)
Gets the train's length at the route location specified- Parameters:
routeLocation- The route location- Returns:
- The train length at the route location
-
getTrainWeight
public int getTrainWeight()
Get the train's weight at the current location.- Returns:
- Train's weight in tons.
-
getTrainWeight
public int getTrainWeight(RouteLocation routeLocation)
-
getTrainHorsePower
public int getTrainHorsePower(RouteLocation routeLocation)
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
public java.lang.String getCabooseRoadAndNumber()
Gets the current caboose road and number if there's one assigned to the train.- Returns:
- Road and number of caboose.
-
setDescription
public void setDescription(java.lang.String description)
-
getRawDescription
public java.lang.String getRawDescription()
-
getDescription
public java.lang.String 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
public void setNumberEngines(java.lang.String number)
-
getNumberEngines
public java.lang.String getNumberEngines()
Get the number of engines that this train requires.- Returns:
- The number of engines that this train requires.
-
getSecondLegNumberEngines
public java.lang.String getSecondLegNumberEngines()
Get the number of engines needed for the second set.- Returns:
- The number of engines needed in route
-
setSecondLegNumberEngines
public void setSecondLegNumberEngines(java.lang.String number)
-
getThirdLegNumberEngines
public java.lang.String getThirdLegNumberEngines()
Get the number of engines needed for the third set.- Returns:
- The number of engines needed in route
-
setThirdLegNumberEngines
public void setThirdLegNumberEngines(java.lang.String number)
-
setEngineRoad
public void setEngineRoad(java.lang.String road)
Set the road name of engines servicing this train.- Parameters:
road- The road name of engines servicing this train.
-
getEngineRoad
public java.lang.String getEngineRoad()
Get the road name of engines servicing this train.- Returns:
- The road name of engines servicing this train.
-
setSecondLegEngineRoad
public void setSecondLegEngineRoad(java.lang.String road)
Set the road name of engines servicing this train 2nd leg.- Parameters:
road- The road name of engines servicing this train.
-
getSecondLegEngineRoad
public java.lang.String getSecondLegEngineRoad()
Get the road name of engines servicing this train 2nd leg.- Returns:
- The road name of engines servicing this train.
-
setThirdLegEngineRoad
public void setThirdLegEngineRoad(java.lang.String road)
Set the road name of engines servicing this train 3rd leg.- Parameters:
road- The road name of engines servicing this train.
-
getThirdLegEngineRoad
public java.lang.String getThirdLegEngineRoad()
Get the road name of engines servicing this train 3rd leg.- Returns:
- The road name of engines servicing this train.
-
setEngineModel
public void setEngineModel(java.lang.String model)
Set the model name of engines servicing this train.- Parameters:
model- The model name of engines servicing this train.
-
getEngineModel
public java.lang.String getEngineModel()
-
setSecondLegEngineModel
public void setSecondLegEngineModel(java.lang.String model)
Set the model name of engines servicing this train's 2nd leg.- Parameters:
model- The model name of engines servicing this train.
-
getSecondLegEngineModel
public java.lang.String getSecondLegEngineModel()
-
setThirdLegEngineModel
public void setThirdLegEngineModel(java.lang.String model)
Set the model name of engines servicing this train's 3rd leg.- Parameters:
model- The model name of engines servicing this train.
-
getThirdLegEngineModel
public java.lang.String getThirdLegEngineModel()
-
replaceModel
protected void replaceModel(java.lang.String oldModel, java.lang.String newModel)
-
setCabooseRoad
public void setCabooseRoad(java.lang.String road)
Set the road name of the caboose servicing this train.- Parameters:
road- The road name of the caboose servicing this train.
-
getCabooseRoad
public java.lang.String getCabooseRoad()
-
setSecondLegCabooseRoad
public void setSecondLegCabooseRoad(java.lang.String road)
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
public java.lang.String getSecondLegCabooseRoad()
-
setThirdLegCabooseRoad
public void setThirdLegCabooseRoad(java.lang.String road)
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
public java.lang.String getThirdLegCabooseRoad()
-
setSecondLegStartRouteLocation
public void setSecondLegStartRouteLocation(RouteLocation rl)
-
getSecondLegStartRouteLocation
public RouteLocation getSecondLegStartRouteLocation()
-
getSecondLegStartLocationName
public java.lang.String getSecondLegStartLocationName()
-
setThirdLegStartRouteLocation
public void setThirdLegStartRouteLocation(RouteLocation rl)
-
getThirdLegStartRouteLocation
public RouteLocation getThirdLegStartRouteLocation()
-
getThirdLegStartLocationName
public java.lang.String getThirdLegStartLocationName()
-
setSecondLegEndRouteLocation
public void setSecondLegEndRouteLocation(RouteLocation rl)
-
getSecondLegEndLocationName
public java.lang.String getSecondLegEndLocationName()
-
getSecondLegEndRouteLocation
public RouteLocation getSecondLegEndRouteLocation()
-
setThirdLegEndRouteLocation
public void setThirdLegEndRouteLocation(RouteLocation rl)
-
getThirdLegEndRouteLocation
public RouteLocation getThirdLegEndRouteLocation()
-
getThirdLegEndLocationName
public java.lang.String getThirdLegEndLocationName()
-
setSecondLegOptions
public void setSecondLegOptions(int options)
Optional changes to train while en route.- Parameters:
options- NO_CABOOSE_OR_FRED, CHANGE_ENGINES, ADD_CABOOSE, HELPER_ENGINES, REMOVE_CABOOSE
-
getSecondLegOptions
public int getSecondLegOptions()
-
setThirdLegOptions
public void setThirdLegOptions(int options)
Optional changes to train while en route.- Parameters:
options- NO_CABOOSE_OR_FRED, CHANGE_ENGINES, ADD_CABOOSE, HELPER_ENGINES, REMOVE_CABOOSE
-
getThirdLegOptions
public int getThirdLegOptions()
-
setComment
public void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
-
getCommentWithColor
public java.lang.String getCommentWithColor()
-
addBuildScript
public void addBuildScript(java.lang.String pathname)
Add a script to run before a train is built- Parameters:
pathname- The script's pathname
-
deleteBuildScript
public void deleteBuildScript(java.lang.String pathname)
-
getBuildScripts
public java.util.List<java.lang.String> 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
public void addAfterBuildScript(java.lang.String pathname)
Add a script to run after a train is built- Parameters:
pathname- The script's pathname
-
deleteAfterBuildScript
public void deleteAfterBuildScript(java.lang.String pathname)
-
getAfterBuildScripts
public java.util.List<java.lang.String> 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
public void addMoveScript(java.lang.String pathname)
Add a script to run when train is moved- Parameters:
pathname- The script's pathname
-
deleteMoveScript
public void deleteMoveScript(java.lang.String pathname)
-
getMoveScripts
public java.util.List<java.lang.String> 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
public void addTerminationScript(java.lang.String pathname)
Add a script to run when train is terminated- Parameters:
pathname- The script's pathname
-
deleteTerminationScript
public void deleteTerminationScript(java.lang.String pathname)
-
getTerminationScripts
public java.util.List<java.lang.String> 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
public java.lang.String getRailroadName()
Gets the optional railroad name for this train.- Returns:
- Train's railroad name.
-
setRailroadName
public void setRailroadName(java.lang.String name)
Overrides the default railroad name for this train.- Parameters:
name- The railroad name for this train.
-
getManifestLogoPathName
public java.lang.String getManifestLogoPathName()
-
setManifestLogoPathName
public void setManifestLogoPathName(java.lang.String pathName)
Overrides the default logo for this train.- Parameters:
pathName- file location for the logo.
-
isShowArrivalAndDepartureTimesEnabled
public boolean isShowArrivalAndDepartureTimesEnabled()
-
setShowArrivalAndDepartureTimes
public void setShowArrivalAndDepartureTimes(boolean enable)
-
isSendCarsToTerminalEnabled
public boolean isSendCarsToTerminalEnabled()
-
setSendCarsToTerminalEnabled
public void setSendCarsToTerminalEnabled(boolean enable)
-
isAllowLocalMovesEnabled
public boolean isAllowLocalMovesEnabled()
Allow local moves if car has a custom load or Final Destination- Returns:
- true if local move is allowed
-
setAllowLocalMovesEnabled
public void setAllowLocalMovesEnabled(boolean enable)
-
isAllowThroughCarsEnabled
public boolean isAllowThroughCarsEnabled()
-
setAllowThroughCarsEnabled
public void setAllowThroughCarsEnabled(boolean enable)
-
isBuildTrainNormalEnabled
public boolean isBuildTrainNormalEnabled()
-
setBuildTrainNormalEnabled
public void setBuildTrainNormalEnabled(boolean enable)
-
isAllowReturnToStagingEnabled
public boolean 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
public void setAllowReturnToStagingEnabled(boolean enable)
-
isServiceAllCarsWithFinalDestinationsEnabled
public boolean isServiceAllCarsWithFinalDestinationsEnabled()
-
setServiceAllCarsWithFinalDestinationsEnabled
public void setServiceAllCarsWithFinalDestinationsEnabled(boolean enable)
-
isBuildConsistEnabled
public boolean isBuildConsistEnabled()
-
setBuildConsistEnabled
public void setBuildConsistEnabled(boolean enable)
-
isSendCarsWithCustomLoadsToStagingEnabled
public boolean isSendCarsWithCustomLoadsToStagingEnabled()
-
setSendCarsWithCustomLoadsToStagingEnabled
public void setSendCarsWithCustomLoadsToStagingEnabled(boolean enable)
-
setBuilt
public void setBuilt(boolean built)
-
isBuilt
public boolean isBuilt()
Used to determine if this train has been built.- Returns:
- true if the train was successfully built.
-
setModified
public void setModified(boolean modified)
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
public boolean isModified()
-
setBuildEnabled
public void setBuildEnabled(boolean build)
Control flag used to decide if this train is to be built.- Parameters:
build- When true, build this train.
-
isBuildEnabled
public boolean isBuildEnabled()
Used to determine if train is to be built.- Returns:
- true if train is to be built.
-
buildIfSelected
public boolean buildIfSelected()
Build this train if the build control flag is true.- Returns:
- True only if train is successfully built.
-
build
public boolean build()
Build this train. Creates a train manifest.- Returns:
- True if build successful.
-
printBuildReport
public boolean printBuildReport()
-
printBuildReport
public boolean printBuildReport(boolean isPreview)
-
setBuildFailed
public void setBuildFailed(boolean status)
-
isBuildFailed
public boolean 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
public void setBuildFailedMessage(java.lang.String message)
-
getBuildFailedMessage
protected java.lang.String getBuildFailedMessage()
-
printManifestIfBuilt
public boolean printManifestIfBuilt()
Print manifest for train if already built.- Returns:
- true if print successful.
-
printManifest
public boolean printManifest(boolean isPreview) throws BuildFailedException
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
public boolean openFile()
-
runFile
public boolean runFile()
-
createCsvManifestFile
public java.io.File createCsvManifestFile()
-
setPrinted
public void setPrinted(boolean printed)
-
isPrinted
public boolean isPrinted()
Used to determine if train manifest was printed.- Returns:
- true if the train manifest was printed.
-
setTrainIconCoordinates
public boolean setTrainIconCoordinates()
Sets the panel position for the train icon for the current route location.- Returns:
- true if train coordinates can be set
-
terminate
public void terminate()
Terminate train.
-
move
public void 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
public boolean move(java.lang.String locationName)
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
public boolean move(RouteLocation rl)
Moves the train to the specified route location- Parameters:
rl- route location- Returns:
- true if successful
-
moveToNextLocation
public boolean moveToNextLocation(java.lang.String locationName)
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
public void loadTrainIcon()
-
moveTrainIcon
public void moveTrainIcon(RouteLocation rl)
-
getIconName
public java.lang.String getIconName()
-
getLeadEngineNumber
public java.lang.String getLeadEngineNumber()
-
getLeadEngineRoadName
public java.lang.String getLeadEngineRoadName()
-
getLeadEngineRoadAndNumber
public java.lang.String getLeadEngineRoadAndNumber()
-
getLeadEngineDccAddress
public java.lang.String getLeadEngineDccAddress()
-
getLeadEngine
public Engine getLeadEngine()
Gets the lead engine, will create it if the program has been restarted- Returns:
- lead engine for this train
-
setLeadEngine
public void setLeadEngine(Engine engine)
-
getLeadEngine
public Engine getLeadEngine(RouteLocation routeLocation)
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
public TrainIcon getTrainIcon()
-
createTrainIcon
public void createTrainIcon(RouteLocation rl)
-
setSwitchListStatus
public void setSwitchListStatus(java.lang.String status)
Sets the print status for switch lists- Parameters:
status- UNKNOWN PRINTED
-
getSwitchListStatus
public java.lang.String getSwitchListStatus()
-
reset
public boolean reset()
Resets the train, removes engines and cars from this train.- Returns:
- true if reset successful
-
checkDepartureTrack
public boolean 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
public void dispose()
-
store
public org.jdom2.Element 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
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-