|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.operations.trains.Train
public class Train
Represents a train on the layout
| Constructor Summary | |
|---|---|
Train(Element e)
Construct this Entry from XML. |
|
Train(String id,
String name)
|
|
| Method Summary | |
|---|---|
boolean |
acceptsBuiltDate(String date)
Determine if train will service rolling stock by built date. |
boolean |
acceptsLoadName(String load)
Determine if train will service a specific load name. |
boolean |
acceptsOwnerName(String owner)
Determine if train will service a specific owner name. |
boolean |
acceptsRoadName(String road)
Determine if train will service a specific road name. |
boolean |
acceptsTypeName(String type)
Returns true if this train will service the type of car or engine. |
void |
addBuildScript(String pathname)
Add a script to run before a train is built |
boolean |
addLoadName(String load)
Add a load that the train will either service or exclude. |
void |
addMoveScript(String pathname)
Add a script to run when train is moved |
boolean |
addOwnerName(String owner)
Add a owner name that the train will either service or exclude. |
void |
addPropertyChangeListener(PropertyChangeListener l)
|
boolean |
addRoadName(String road)
Add a road name that the train will either service or exclude. |
void |
addTerminationScript(String pathname)
Add a script to run when train is terminated |
void |
addTrainSkipsLocation(String locationId)
Train will skip the RouteLocation |
void |
addTypeName(String type)
Add a car or engine type name that this train will service. |
void |
build()
Build this train. |
boolean |
buildIfSelected()
Build this train if the build control flag is true. |
void |
createTrainIcon()
|
void |
deleteBuildScript(String pathname)
|
boolean |
deleteLoadName(String load)
Delete a load name that the train will either service or exclude. |
void |
deleteMoveScript(String pathname)
|
boolean |
deleteOwnerName(String owner)
Delete a owner name that the train will either service or exclude. |
boolean |
deleteRoadName(String road)
Delete a road name that the train will either service or exclude. |
void |
deleteTerminationScript(String pathname)
|
void |
deleteTrainSkipsLocation(String locationId)
|
void |
deleteTypeName(String type)
|
void |
dispose()
|
protected void |
firePropertyChange(String p,
Object old,
Object n)
|
boolean |
getBuild()
Deprecated. |
boolean |
getBuildFailed()
Returns true if the train build failed. |
List<String> |
getBuildScripts()
Gets a list of pathnames (scripts) to run before this train is built |
boolean |
getBuilt()
Deprecated. |
String |
getBuiltEndYear()
|
String |
getBuiltStartYear()
|
String |
getCabooseRoad()
|
String |
getComment()
|
RouteLocation |
getCurrentLocation()
Get train's current location |
String |
getCurrentLocationName()
Get train's current location name |
int |
getDepartTimeMinutes()
Get train's departure time in minutes from midnight for sorting |
String |
getDepartureTime()
Get's train's departure time |
String |
getDepartureTimeHour()
|
String |
getDepartureTimeMinute()
|
String |
getDescription()
|
String |
getEngineModel()
|
String |
getEngineRoad()
Get the road name of engines servicing this train. |
String |
getExpectedArrivalTime(RouteLocation routeLocation)
Gets the expected time when this train will arrive at the location rl. |
String |
getFormatedDepartureTime()
Get's train's departure time in 12hr or 24hr format |
String |
getIconName()
|
String |
getId()
|
Engine |
getLeadEngine()
Gets the lead engine, will create it if the program has been restarted |
String[] |
getLoadNames()
Provides a list of loads that the train will either service or exclude. |
String |
getLoadOption()
Gets the car load option for this train. |
String |
getManifestLogoURL()
|
List<String> |
getMoveScripts()
Gets a list of pathnames (scripts) to run when this train moved |
String |
getName()
Get's a train's name |
RouteLocation |
getNextLocation()
|
String |
getNextLocationName()
Get the train's next location name |
int |
getNumberCarsInTrain()
Gets the number of cars in the train at the current location in the train's route. |
int |
getNumberCarsWorked()
|
String |
getNumberEngines()
Get the number of engines that this train requires. |
String[] |
getOwnerNames()
Provides a list of owner names that the train will either service or exclude. |
String |
getOwnerOption()
|
boolean |
getPrinted()
|
String |
getRailroadName()
Gets the optional railroad name for this train. |
int |
getRequirements()
Get a train's requirements with regards to the last car in the train. |
String[] |
getRoadNames()
Provides a list of road names that the train will either service or exclude. |
String |
getRoadOption()
Get how this train deals with road names. |
Route |
getRoute()
Gets the train's route |
String |
getSecondLegCabooseRoad()
|
RouteLocation |
getSecondLegEndLocation()
|
String |
getSecondLegEndLocationName()
|
String |
getSecondLegEngineModel()
|
String |
getSecondLegEngineRoad()
Get the road name of engines servicing this train 2nd leg. |
String |
getSecondLegNumberEngines()
Get the number of engines needed for the second set. |
int |
getSecondLegOptions()
|
RouteLocation |
getSecondLegStartLocation()
|
String |
getSecondLegStartLocationName()
|
String |
getStatus()
Get train's status |
String |
getSwitchListStatus()
|
List<String> |
getTerminationScripts()
Gets a list of pathnames (scripts) to run when this train terminates |
String |
getThirdLegCabooseRoad()
|
RouteLocation |
getThirdLegEndLocation()
|
String |
getThirdLegEndLocationName()
|
String |
getThirdLegEngineModel()
|
String |
getThirdLegEngineRoad()
Get the road name of engines servicing this train 3rd leg. |
String |
getThirdLegNumberEngines()
Get the number of engines needed for the third set. |
int |
getThirdLegOptions()
|
RouteLocation |
getThirdLegStartLocation()
|
String |
getThirdLegStartLocationName()
|
String |
getTrainDepartsName()
Get the train's departure location's name |
protected RouteLocation |
getTrainDepartsRouteLocation()
|
TrainIcon |
getTrainIcon()
|
int |
getTrainLength()
Gets the train's length at the current location in the train's route. |
String |
getTrainRouteName()
Get's the train's route name. |
String |
getTrainTerminatesName()
Get train's final location's name |
protected RouteLocation |
getTrainTerminatesRouteLocation()
|
int |
getTrainWeight()
Get the train's weight at the current location. |
String[] |
getTypeNames()
Get's the type names of rolling stock this train will service |
boolean |
isBuildEnabled()
Used to determine if train is to be built. |
boolean |
isBuilt()
Used to determine if this train has been built. |
boolean |
isTrainInRoute()
Used to determine if train has departed its |
void |
loadTrainIcon()
|
void |
move()
Move train to next location in route. |
protected void |
moveTrainIcon(RouteLocation rl)
|
void |
printBuildReport()
|
boolean |
printBuildReport(boolean isPreview)
|
boolean |
printManifest(boolean isPreview)
Print manifest for train. |
boolean |
printManifestIfBuilt()
Print manifest for train if already built. |
void |
propertyChange(PropertyChangeEvent e)
|
void |
removePropertyChangeListener(PropertyChangeListener l)
|
void |
replaceOwner(String oldName,
String newName)
|
void |
replaceRoad(String oldRoad,
String newRoad)
|
void |
replaceType(String oldType,
String newType)
|
boolean |
reset()
Resets the train, removes engines and cars from this train. |
boolean |
servicesCar(Car car)
Determines if this train will service this car. |
void |
setBuild(boolean build)
Deprecated. |
void |
setBuildEnabled(boolean build)
Control flag used to decide if this train is to be built. |
void |
setBuildFailed(boolean status)
|
void |
setBuilt(boolean built)
|
void |
setBuiltEndYear(String year)
Only rolling stock built in or before this year will be used. |
void |
setBuiltStartYear(String year)
Only rolling stock built in or after this year will be used. |
void |
setCabooseRoad(String road)
Set the road name of the caboose servicing this train. |
void |
setComment(String comment)
|
void |
setCurrentLocation(RouteLocation location)
Set train's current route location |
void |
setDepartureTime(String hour,
String minute)
|
void |
setDescription(String description)
|
void |
setEngineModel(String model)
Set the model name of engines servicing this train. |
void |
setEngineRoad(String road)
Set the road name of engines servicing this train. |
void |
setLeadEngine(Engine engine)
|
void |
setLoadOption(String option)
Set how this train deals with car loads |
void |
setManifestLogoURL(String pathName)
Overrides the default logo for this train. |
void |
setName(String name)
|
void |
setNumberEngines(String number)
|
void |
setOwnerOption(String option)
Set how this train deals with car owner names |
void |
setRailroadName(String name)
Overrides the default railroad name for this train. |
void |
setRequirements(int requires)
Set train requirements |
void |
setRoadOption(String option)
Set how this train deals with car road names. |
void |
setRoute(Route route)
|
void |
setSecondLegCabooseRoad(String road)
Set the road name of the second leg caboose servicing this train. |
void |
setSecondLegEndLocation(RouteLocation rl)
|
void |
setSecondLegEngineModel(String model)
Set the model name of engines servicing this train's 2nd leg. |
void |
setSecondLegEngineRoad(String road)
Set the road name of engines servicing this train 2nd leg. |
void |
setSecondLegNumberEngines(String number)
|
void |
setSecondLegOptions(int options)
|
void |
setSecondLegStartLocation(RouteLocation rl)
|
void |
setStatus(String status)
Set's the train's status |
void |
setSwitchListStatus(String status)
Sets the print status for this location's switch list |
void |
setThirdLegCabooseRoad(String road)
Set the road name of the third leg caboose servicing this train. |
void |
setThirdLegEndLocation(RouteLocation rl)
|
void |
setThirdLegEngineModel(String model)
Set the model name of engines servicing this train's 3rd leg. |
void |
setThirdLegEngineRoad(String road)
Set the road name of engines servicing this train 3rd leg. |
void |
setThirdLegNumberEngines(String number)
|
void |
setThirdLegOptions(int options)
|
void |
setThirdLegStartLocation(RouteLocation rl)
|
boolean |
setTrainIconCoordinates()
Sets the panel position for the train icon for the current route location. |
void |
setTypeNames(String[] types)
Set the type of cars or engines this train will service, see types in Cars and Engines. |
boolean |
skipsLocation(String locationId)
Determines if this train skips a location (doesn't service the location). |
Element |
store()
Create an XML element to represent this Entry. |
void |
terminate()
Terminate train. |
String |
toString()
Get's a train's name |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String _id
protected String _name
protected String _description
protected RouteLocation _current
protected String _status
protected boolean _built
protected boolean _build
protected boolean _buildFailed
protected boolean _printed
protected Route _route
protected String _roadOption
protected int _requires
protected String _numberEngines
protected String _engineRoad
protected String _engineModel
protected String _cabooseRoad
protected Calendar _departureTime
protected String _leadEngineId
protected String _builtStartYear
protected String _builtEndYear
protected String _loadOption
protected String _ownerOption
protected List<String> _buildScripts
protected List<String> _moveScripts
protected List<String> _terminationScripts
protected String _railroadName
protected String _logoURL
protected Engine _leadEngine
protected String _switchListStatus
protected String _comment
protected int _leg2Options
protected RouteLocation _leg2Start
protected RouteLocation _end2Leg
protected String _leg2Engines
protected String _leg2Road
protected String _leg2Model
protected String _leg2CabooseRoad
protected int _leg3Options
protected RouteLocation _leg3Start
protected RouteLocation _leg3End
protected String _leg3Engines
protected String _leg3Road
protected String _leg3Model
protected String _leg3CabooseRoad
public static final int CHANGE_ENGINES
public static final int HELPER_ENGINES
public static final int CHANGE_CABOOSE
public static final String DISPOSE_CHANGED_PROPERTY
public static final String STOPS_CHANGED_PROPERTY
public static final String TYPES_CHANGED_PROPERTY
public static final String BUILT_CHANGED_PROPERTY
public static final String BUILD_CHANGED_PROPERTY
public static final String ROADS_CHANGED_PROPERTY
public static final String LOADS_CHANGED_PROPERTY
public static final String OWNERS_CHANGED_PROPERTY
public static final String NAME_CHANGED_PROPERTY
public static final String DESCRIPTION_CHANGED_PROPERTY
public static final String STATUS_CHANGED_PROPERTY
public static final String DEPARTURETIME_CHANGED_PROPERTY
public static final String TRAIN_LOCATION_CHANGED_PROPERTY
public static final String TRAIN_ROUTE_CHANGED_PROPERTY
public static final String BUILDFAILED
public static final String BUILDING
public static final String BUILT
public static final String PARTIALBUILT
public static final String TERMINATED
public static final String TRAINRESET
public static final String TRAININROUTE
public static final int NONE
public static final int CABOOSE
public static final int FRED
public static final String ALLROADS
public static final String INCLUDEROADS
public static final String EXCLUDEROADS
public static final String ALLOWNERS
public static final String INCLUDEOWNERS
public static final String EXCLUDEOWNERS
public static final String ALLLOADS
public static final String INCLUDELOADS
public static final String EXCLUDELOADS
public static final String UNKNOWN
public static final String PRINTED
public static final String AUTO
protected RouteLocation _trainIconRl
protected TrainIcon _trainIcon
| Constructor Detail |
|---|
public Train(String id,
String name)
public Train(Element e)
e - Consist XML element| Method Detail |
|---|
public String getId()
public void setName(String name)
public String toString()
toString in class Objectpublic String getName()
public String getDepartureTime()
public String getFormatedDepartureTime()
public int getDepartTimeMinutes()
public void setDepartureTime(String hour,
String minute)
public String getDepartureTimeHour()
public String getDepartureTimeMinute()
public String getExpectedArrivalTime(RouteLocation routeLocation)
public void setRequirements(int requires)
requires - NONE CABOOSE FREDpublic int getRequirements()
public void setRoute(Route route)
public Route getRoute()
public String getTrainRouteName()
public String getTrainDepartsName()
protected RouteLocation getTrainDepartsRouteLocation()
public String getTrainTerminatesName()
protected RouteLocation getTrainTerminatesRouteLocation()
public void setCurrentLocation(RouteLocation location)
public String getCurrentLocationName()
public RouteLocation getCurrentLocation()
public String getNextLocationName()
public RouteLocation getNextLocation()
public void setStatus(String status)
status - BUILDING PARTIALBUILT BUILT TERMINATED TRAINRESET TRAININROUTEpublic String getStatus()
public boolean isTrainInRoute()
public void addTrainSkipsLocation(String locationId)
locationId - RouteLocation Idpublic void deleteTrainSkipsLocation(String locationId)
public boolean skipsLocation(String locationId)
locationId - The route location id.
public String[] getTypeNames()
public void setTypeNames(String[] types)
types - The type names for cars and or enginespublic void addTypeName(String type)
type - The new type name to service.public void deleteTypeName(String type)
public boolean acceptsTypeName(String type)
type - The car or engine type name.
public void replaceType(String oldType,
String newType)
public String getRoadOption()
public void setRoadOption(String option)
option - ALLROADS INCLUDEROADS EXCLUDEROADSpublic String[] getRoadNames()
public boolean addRoadName(String road)
public boolean deleteRoadName(String road)
public boolean acceptsRoadName(String road)
road - the road name to check.
public void replaceRoad(String oldRoad,
String newRoad)
public String getLoadOption()
public void setLoadOption(String option)
option - ALLLOADS INCLUDELOADS EXCLUDELOADSpublic String[] getLoadNames()
public boolean addLoadName(String load)
public boolean deleteLoadName(String load)
public boolean acceptsLoadName(String load)
load - the load name to check.
public String getOwnerOption()
public void setOwnerOption(String option)
option - ALLOWNERS INCLUDEOWNERS EXCLUDEOWNERSpublic String[] getOwnerNames()
public boolean addOwnerName(String owner)
public boolean deleteOwnerName(String owner)
public boolean acceptsOwnerName(String owner)
owner - the owner name to check.
public void replaceOwner(String oldName,
String newName)
public void setBuiltStartYear(String year)
year - public String getBuiltStartYear()
public void setBuiltEndYear(String year)
year - public String getBuiltEndYear()
public boolean acceptsBuiltDate(String date)
date -
public boolean servicesCar(Car car)
car - The car to be tested.
public int getNumberCarsWorked()
public int getNumberCarsInTrain()
public int getTrainLength()
public int getTrainWeight()
public void setDescription(String description)
public String getDescription()
public void setNumberEngines(String number)
public String getNumberEngines()
public String getSecondLegNumberEngines()
public void setSecondLegNumberEngines(String number)
public String getThirdLegNumberEngines()
public void setThirdLegNumberEngines(String number)
public void setEngineRoad(String road)
road - The road name of engines servicing this train.public String getEngineRoad()
public void setSecondLegEngineRoad(String road)
road - The road name of engines servicing this train.public String getSecondLegEngineRoad()
public void setThirdLegEngineRoad(String road)
road - The road name of engines servicing this train.public String getThirdLegEngineRoad()
public void setEngineModel(String model)
model - The model name of engines servicing this train.public String getEngineModel()
public void setSecondLegEngineModel(String model)
model - The model name of engines servicing this train.public String getSecondLegEngineModel()
public void setThirdLegEngineModel(String model)
model - The model name of engines servicing this train.public String getThirdLegEngineModel()
public void setCabooseRoad(String road)
road - The road name of the caboose servicing this train.public String getCabooseRoad()
public void setSecondLegCabooseRoad(String road)
road - The road name of the caboose servicing this train's 2nd leg.public String getSecondLegCabooseRoad()
public void setThirdLegCabooseRoad(String road)
road - The road name of the caboose servicing this train's 3rd leg.public String getThirdLegCabooseRoad()
public void setSecondLegStartLocation(RouteLocation rl)
public RouteLocation getSecondLegStartLocation()
public String getSecondLegStartLocationName()
public void setThirdLegStartLocation(RouteLocation rl)
public RouteLocation getThirdLegStartLocation()
public String getThirdLegStartLocationName()
public void setSecondLegEndLocation(RouteLocation rl)
public String getSecondLegEndLocationName()
public RouteLocation getSecondLegEndLocation()
public void setThirdLegEndLocation(RouteLocation rl)
public RouteLocation getThirdLegEndLocation()
public String getThirdLegEndLocationName()
public void setSecondLegOptions(int options)
public int getSecondLegOptions()
public void setThirdLegOptions(int options)
public int getThirdLegOptions()
public void setComment(String comment)
public String getComment()
public void addBuildScript(String pathname)
pathname - The script's pathnamepublic void deleteBuildScript(String pathname)
public List<String> getBuildScripts()
public void addMoveScript(String pathname)
pathname - The script's pathnamepublic void deleteMoveScript(String pathname)
public List<String> getMoveScripts()
public void addTerminationScript(String pathname)
pathname - The script's pathnamepublic void deleteTerminationScript(String pathname)
public List<String> getTerminationScripts()
public String getRailroadName()
public void setRailroadName(String name)
name - The railroad name for this train.public String getManifestLogoURL()
public void setManifestLogoURL(String pathName)
pathName - file location for the logo.public void setBuilt(boolean built)
public boolean isBuilt()
@Deprecated public boolean getBuilt()
public void setBuildEnabled(boolean build)
build - When true, build this train.public boolean isBuildEnabled()
@Deprecated public void setBuild(boolean build)
build - When true, build this train.@Deprecated public boolean getBuild()
public boolean buildIfSelected()
public void build()
public void printBuildReport()
public boolean printBuildReport(boolean isPreview)
public void setBuildFailed(boolean status)
public boolean getBuildFailed()
public boolean printManifestIfBuilt()
public boolean printManifest(boolean isPreview)
public boolean getPrinted()
public boolean setTrainIconCoordinates()
public void terminate()
public void move()
public void loadTrainIcon()
protected void moveTrainIcon(RouteLocation rl)
public String getIconName()
public Engine getLeadEngine()
public void setLeadEngine(Engine engine)
public TrainIcon getTrainIcon()
public void createTrainIcon()
public void setSwitchListStatus(String status)
status - UNKNOWN PRINTEDpublic String getSwitchListStatus()
public boolean reset()
public void dispose()
public Element store()
public void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListenerpublic void addPropertyChangeListener(PropertyChangeListener l)
public void removePropertyChangeListener(PropertyChangeListener l)
protected void firePropertyChange(String p,
Object old,
Object n)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||