Class RollingStock
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.rollingstock.RollingStock
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Identifiable,PropertyChangeFirer,PropertyChangeProvider
public abstract class RollingStock
extends PropertyChangeSupport
implements Identifiable, PropertyChangeListener
Represents rolling stock, both powered (locomotives) and not powered (cars)
on the layout.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Stringprotected booleanprotected intprotected Stringprotected Stringprotected Locationprotected Divisionprotected Stringprotected Dateprotected Stringprotected Stringprotected Trainprotected Stringprotected booleanprotected Locationprotected booleanprotected intprotected Stringprotected booleanprotected Stringprotected Stringprotected Stringprotected Stringprotected RouteLocationprotected Stringprotected RouteLocationprotected booleanprotected Stringprotected IdTagprotected PropertyChangeListenerprotected Trackprotected Trackprotected Trainprotected Stringprotected Stringprotected Stringprotected Stringprotected Dateprotected Locationstatic final Stringstatic final intstatic final intprotected static final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final String(package private) LocationManagerstatic final intstatic final Stringprotected intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionRollingStock(String road, String number) RollingStock(org.jdom2.Element e) Construct this Entry from XML. -
Method Summary
Modifier and TypeMethodDescriptioncheckDestination(Location destination, Track track) Used to check destination track to see if it will accept rolling stockstatic Stringvoiddispose()Remove rolling stock.intintgetBuilt()intgetColor()getId()Get the identity of the object.getIdTag()Provides the last date when this rolling stock was movedProvides the last date when this rolling stock was movedUsed to determine which train delivered a car to an interchange track.gets the body length of the rolling stockintGet rolling stock's location idGet rolling stock's location nameintgetMoves()getRfid()Where in a train's route this car residesProvides the last date when this rolling stock was movedintReturns the length of the rolling stock including the couplersgetTrack()Get rolling stock's track idGet rolling stock's track namegetTrain()getValue()Provides the last date when this rolling stock was moved, or was reset from a built train, as a string.booleanisClone()booleanbooleanbooleanprotected voidmoveRollingStock(RouteLocation current, RouteLocation next) voidvoidreset()voidsetBlocking(int number) voidSet the date that the rolling stock was built.voidsetClone(boolean clone) voidsetCloneOrder(int number) voidvoidsetComment(String comment) voidsetDestination(Location destination) Sets rolling stock destination without reserving destination track space or drop count.setDestination(Location destination, Track track) Sets rolling stock destination on the layoutsetDestination(Location destination, Track track, boolean force) Sets rolling stock destination on the layoutvoidsetDestinationTrack(Track track) Sets rolling stock destination track without reserving destination track space or drop count.protected voidsetDirtyAndFirePropertyChange(String p, Object old, Object n) voidsetDivision(Division division) voidSets the id tag for this rolling stock.voidsetLastDate(String date) Sets the last date when this rolling stock was moved.voidsetLastDate(Date date) Sets the last date when this rolling stock was movedvoidUsed to block cars from stagingvoidsetLastRouteId(String id) Sets the id of the route that was used to set out the rolling stock.voidsetLastTrackId(String id) voidsetLastTrain(Train train) Sets the last train that serviced this rolling stock.voidSets the body length of the rolling stock.setLocation(Location location, Track track) Sets rolling stock location on the layoutsetLocation(Location location, Track track, boolean force) Sets rolling stock location on the layoutvoidsetLocationUnknown(boolean unknown) Set the rolling stock location as unknown.voidsetMoves(int moves) voidSet the rolling stock identification or road numbervoidsetOutOfService(boolean outOfService) Sets the rolling stock service state.voidsetOwnerName(String owner) voidsetPickupTime(String time) voidSets the RFID for this rolling stock.voidsetRoadName(String road) voidsetRouteDestination(RouteLocation routeDestination) Set where in a train's route this rolling stock will be set out.voidsetRouteLocation(RouteLocation routeLocation) Sets the location where the rolling stock will be picked up by the train.voidsetSelected(boolean selected) voidsetSetoutTime(String time) voidSet the rolling stock's location and track.voidSets the train that will service this rolling stock.voidsetTypeName(String type) Sets the type of rolling stock.voidSets the value (cost, price) for this rolling stock.voidvoidsetWeightTons(String weight) Sets the full scale weight in tons.protected org.jdom2.Elementstore(org.jdom2.Element e) Add XML elements to represent this Entry.testLocation(Location location, Track track) Used to confirm that a track is associated with a location, and that rolling stock can be placed on track.toString()For combobox and identificationMethods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
NONE
- See Also:
-
DEFAULT_BLOCKING_ORDER
- See Also:
-
MAX_BLOCKING_ORDER
- See Also:
-
FORCE
- See Also:
-
DEFAULT_WEIGHT
- See Also:
-
_id
-
_number
-
_road
-
_type
-
_length
-
_color
-
_weight
-
_weightTons
-
_built
-
_owner
-
_comment
-
_routeId
-
_rfid
-
_value
-
_lastDate
-
_locationUnknown
-
_outOfService
-
_selected
-
_location
-
_track
-
_destination
-
_trackDestination
-
_train
-
_routeLocation
-
_routeDestination
-
_division
-
_clone
-
_cloneOrder
-
_moves
-
_lastLocationId
-
_lastTrackId
-
_lastTrain
-
_blocking
-
_pickupTime
-
_setoutTime
-
_tag
-
_tagListener
-
_whereLastSeen
-
_whenLastSeen
-
LOCATION_UNKNOWN
- See Also:
-
number
-
ERROR_TRACK
- See Also:
-
TRACK_CHANGED_PROPERTY
- See Also:
-
DESTINATION_TRACK_CHANGED_PROPERTY
- See Also:
-
TRAIN_CHANGED_PROPERTY
- See Also:
-
LENGTH_CHANGED_PROPERTY
- See Also:
-
TYPE_CHANGED_PROPERTY
- See Also:
-
ROUTE_LOCATION_CHANGED_PROPERTY
- See Also:
-
ROUTE_DESTINATION_CHANGED_PROPERTY
- See Also:
-
COMMENT_CHANGED_PROPERTY
- See Also:
-
COUPLERS
-
locationManager
-
_lengthChange
-
-
Constructor Details
-
RollingStock
public RollingStock() -
RollingStock
-
RollingStock
Construct this Entry from XML.- Parameters:
e- RollingStock XML element
-
-
Method Details
-
createId
-
getId
Description copied from interface:IdentifiableGet the identity of the object.- Specified by:
getIdin interfaceIdentifiable- Returns:
- the identity
-
setNumber
Set the rolling stock identification or road number- Parameters:
number- The rolling stock road number.
-
getNumber
-
setRoadName
-
getRoadName
-
toString
For combobox and identification -
setTypeName
Sets the type of rolling stock. "Boxcar" for example is a type of car.- Parameters:
type- The type of rolling stock.
-
getTypeName
-
setLength
Sets the body length of the rolling stock. For example, a 40' boxcar would be entered as 40 feet. Coupler length is added by the program when determining if a car could fit on a track.- Parameters:
length- the body length in feet or meters- See Also:
-
getLength
gets the body length of the rolling stock- Returns:
- length in feet or meters
- See Also:
-
getLengthInteger
-
getTotalLength
Returns the length of the rolling stock including the couplers- Returns:
- total length of the rolling stock in feet or meters
-
setColor
-
getColor
-
setWeight
- Parameters:
weight- rolling stock weight in ounces.
-
getWeight
-
setWeightTons
Sets the full scale weight in tons.- Parameters:
weight- full scale rolling stock weight in tons.
-
getWeightTons
-
getAdjustedWeightTons
-
setBuilt
Set the date that the rolling stock was built. Use 4 digits for the year, or the format MM-YY where MM is the two digit month, and YY is the last two years if the rolling stock was built in the 1900s. Use MM-YYYY for units build after 1999.- Parameters:
built- The string built date.
-
getBuilt
-
getStatus
- Returns:
- location unknown symbol, out of service symbol, or none if car okay
-
getLocation
-
getLocationName
Get rolling stock's location name- Returns:
- empty string if rolling stock isn't on layout
-
getSplitLocationName
-
getLocationId
Get rolling stock's location id- Returns:
- empty string if rolling stock isn't on the layout
-
getTrack
-
setTrack
Set the rolling stock's location and track. Doesn't do any checking and does not fire a property change. Used exclusively by the Router code. Use setLocation(Location, Track) instead.- Parameters:
track- to place the rolling stock on.
-
getTrackName
Get rolling stock's track name- Returns:
- empty string if rolling stock isn't on a track
-
getSplitTrackName
-
getTrackType
-
getTrackId
Get rolling stock's track id- Returns:
- empty string if rolling stock isn't on a track
-
setLocation
Sets rolling stock location on the layout- Parameters:
location- The Location.track- (yard, spur, staging, or interchange track)- Returns:
- "okay" if successful, "type" if the rolling stock's type isn't acceptable, "road" if rolling stock road isn't acceptable, or "length" if the rolling stock length didn't fit.
-
setLocation
Sets rolling stock location on the layout- Parameters:
location- The Location.track- (yard, spur, staging, or interchange track)force- when true place rolling stock ignore track length, type, and road- Returns:
- "okay" if successful, "type" if the rolling stock's type isn't acceptable, "road" if rolling stock road isn't acceptable, or "length" if the rolling stock length didn't fit.
-
testLocation
Used to confirm that a track is associated with a location, and that rolling stock can be placed on track.- Parameters:
location- The locationtrack- The track, can be null- Returns:
- OKAY if track exists at location and rolling stock can be placed on track, ERROR_TRACK if track isn't at location, other if rolling stock can't be placed on track.
-
setDestination
Sets rolling stock destination on the layout- Parameters:
destination- The Location.track- (yard, spur, staging, or interchange track)- Returns:
- "okay" if successful, "type" if the rolling stock's type isn't acceptable, or "length" if the rolling stock length didn't fit.
-
setDestination
Sets rolling stock destination on the layout- Parameters:
destination- The Location.track- (yard, spur, staging, or interchange track)force- when true ignore track length, type, and road when setting destination- Returns:
- "okay" if successful, "type" if the rolling stock's type isn't acceptable, or "length" if the rolling stock length didn't fit.
-
checkDestination
Used to check destination track to see if it will accept rolling stock- Parameters:
destination- The Location.track- The Track at destination.- Returns:
- status OKAY, TYPE, ROAD, LENGTH, ERROR_TRACK
-
getDestination
-
setDestination
Sets rolling stock destination without reserving destination track space or drop count. Does not fire a property change. Used by car router to test destinations. Use setDestination(Location, Track) instead.- Parameters:
destination- for the rolling stock
-
getDestinationName
-
getSplitDestinationName
-
getDestinationId
-
setDestinationTrack
Sets rolling stock destination track without reserving destination track space or drop count. Used by car router to test destinations. Does not fire a property change. Use setDestination(Location, Track) instead.- Parameters:
track- The Track for set out at destination.
-
getDestinationTrack
-
getDestinationTrackName
-
getSplitDestinationTrackName
-
getDestinationTrackId
-
setClone
-
isClone
-
setCloneOrder
-
getCloneOrder
-
setDivision
-
getDivision
-
getDivisionName
-
getDivisionId
-
setLastLocationId
Used to block cars from staging- Parameters:
id- The location id from where the car came from before going into staging.
-
getLastLocationId
-
getLastLocationName
-
setLastTrackId
-
getLastTrackId
-
getLastTrackName
-
setMoves
-
getMoves
-
setTrain
Sets the train that will service this rolling stock.- Parameters:
train- The Train.
-
getTrain
-
getTrainName
-
setLastTrain
Sets the last train that serviced this rolling stock.- Parameters:
train- The last Train.
-
getLastTrain
-
getLastTrainName
-
setRouteLocation
Sets the location where the rolling stock will be picked up by the train.- Parameters:
routeLocation- the pick up location for this rolling stock.
-
getRouteLocation
Where in a train's route this car resides- Returns:
- the location in a train's route
-
getRouteLocationId
-
getLastRouteId
Used to determine which train delivered a car to an interchange track.- Returns:
- the route id of the last train delivering this car.
-
setLastRouteId
Sets the id of the route that was used to set out the rolling stock. Used to determine if the rolling stock can be pick ups from an interchange track.- Parameters:
id- The route id.
-
getValue
-
setValue
Sets the value (cost, price) for this rolling stock. Currently has nothing to do with operations. But nice to have.- Parameters:
value- a string representing what this item is worth.
-
getRfid
-
setRfid
Sets the RFID for this rolling stock.- Parameters:
id- 12 character RFID string.
-
getIdTag
-
setIdTag
Sets the id tag for this rolling stock. The id tag isn't saved, between session but the tag label is saved as _rfid.- Parameters:
tag- the id tag
-
getWhereLastSeenName
-
getWhereLastSeen
-
getTrackLastSeen
-
getTrackLastSeenName
-
getWhenLastSeen
-
getWhenLastSeenDate
Provides the last date when this rolling stock was moved, or was reset from a built train, as a string.- Returns:
- date
-
getSortDate
Provides the last date when this rolling stock was moved- Returns:
- String yyyy/MM/dd HH:mm:ss
-
getLastDate
Provides the last date when this rolling stock was moved- Returns:
- String MM/dd/yyyy HH:mm:ss
-
setLastDate
Sets the last date when this rolling stock was moved- Parameters:
date- The Date when this rolling stock was last moved.
-
getLastMoveDate
Provides the last date when this rolling stock was moved- Returns:
- date
-
setLastDate
Sets the last date when this rolling stock was moved. This method is used only for loading data from a file. Use setLastDate(Date) instead.- Parameters:
date- yyyy/MM/dd HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM/dd/yyyy hh:mmaa, or MM/dd/yyyy HH:mm
-
setBlocking
-
getBlocking
-
setRouteDestination
Set where in a train's route this rolling stock will be set out.- Parameters:
routeDestination- the location where the rolling stock is to leave the train.
-
getRouteDestination
-
getRouteDestinationId
-
setOwnerName
-
getOwnerName
-
setLocationUnknown
Set the rolling stock location as unknown.- Parameters:
unknown- when true, the rolling stock location is unknown.
-
isLocationUnknown
- Returns:
- true when car's location is unknown
-
setOutOfService
Sets the rolling stock service state. When true, rolling stock is out of service. Normal state is false, the rolling stock is in service and available.- Parameters:
outOfService- when true, out of service
-
isOutOfService
- Returns:
- true when rolling stock is out of service
-
setSelected
-
isSelected
- Returns:
- true when rolling stock is selected
-
setComment
-
getComment
-
setPickupTime
-
getPickupTime
-
setSetoutTime
-
getSetoutTime
-
moveRollingStock
-
reset
-
dispose
Remove rolling stock. Releases all listeners. -
store
Add XML elements to represent this Entry.- Parameters:
e- Element for car or engine store.- Returns:
- Contents in a JDOM Element
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
setDirtyAndFirePropertyChange
-