Class Engine
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.rollingstock.RollingStock
jmri.jmrit.operations.rollingstock.engines.Engine
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Identifiable,PropertyChangeFirer,PropertyChangeProvider
Represents a locomotive on the layout
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int(package private) EngineModelsstatic final Stringstatic final int(package private) booleanFields inherited from class jmri.jmrit.operations.rollingstock.RollingStock
_blocking, _built, _clone, _cloneOrder, _color, _comment, _destination, _division, _id, _lastDate, _lastLocationId, _lastTrackId, _lastTrain, _length, _lengthChange, _location, _locationUnknown, _moves, _number, _outOfService, _owner, _pickupTime, _rfid, _road, _routeDestination, _routeId, _routeLocation, _selected, _setoutTime, _tag, _tagListener, _track, _trackDestination, _train, _type, _value, _weight, _weightTons, _whenLastSeen, _whereLastSeen, COMMENT_CHANGED_PROPERTY, COUPLERS, DEFAULT_BLOCKING_ORDER, DEFAULT_WEIGHT, DESTINATION_TRACK_CHANGED_PROPERTY, ERROR_TRACK, FORCE, LENGTH_CHANGED_PROPERTY, LOCATION_UNKNOWN, MAX_BLOCKING_ORDER, NONE, number, ROUTE_DESTINATION_CHANGED_PROPERTY, ROUTE_LOCATION_CHANGED_PROPERTY, TRACK_CHANGED_PROPERTY, TRAIN_CHANGED_PROPERTY, TYPE_CHANGED_PROPERTYFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckDestination(Location destination, Track track) Used to check destination track to see if it will accept locomotivevoiddispose()Remove rolling stock.intB units that aren't part of a consist are blocked at the end.Get the consist for this locomotiveGet the DCC address for this engine from the JMRI roster.getHp()intgets the body length of the rolling stockgetModel()Get the RosterEntry for this engine from the JMRI roster.booleanisBunit()booleanisLead()Used to determine if engine is lead engine in a consistprotected voidmoveRollingStock(RouteLocation current, RouteLocation next) Determine if there's a change in the lead locomotive.voidvoidsetBunit(boolean bUnit) voidsetConsist(Consist consist) Place locomotive in a consistprotected voidsetDirtyAndFirePropertyChange(String p, Object old, Object n) voidSet the locomotive horsepower rating for this locomotive's modelvoidSet the locomotive length for this locomotive's modelvoidSet the locomotive's model.voidsetTypeName(String type) Set the locomotive type for this locomotive's modelvoidsetWeightTons(String weight) Set the locomotive weight for this locomotive's modelorg.jdom2.Elementstore()Create an XML element to represent this Entry.Methods inherited from class jmri.jmrit.operations.rollingstock.RollingStock
createId, getAdjustedWeightTons, getBuilt, getCloneOrder, getColor, getComment, getDestination, getDestinationId, getDestinationName, getDestinationTrack, getDestinationTrackId, getDestinationTrackName, getDivision, getDivisionId, getDivisionName, getId, getIdTag, getLastDate, getLastLocationId, getLastLocationName, getLastMoveDate, getLastRouteId, getLastTrackId, getLastTrackName, getLastTrain, getLastTrainName, getLengthInteger, getLocation, getLocationId, getLocationName, getMoves, getNumber, getOwnerName, getPickupTime, getRfid, getRoadName, getRouteDestination, getRouteDestinationId, getRouteLocation, getRouteLocationId, getSetoutTime, getSortDate, getSplitDestinationName, getSplitDestinationTrackName, getSplitLocationName, getSplitTrackName, getStatus, getTotalLength, getTrack, getTrackId, getTrackLastSeen, getTrackLastSeenName, getTrackName, getTrackType, getTrain, getTrainName, getValue, getWeight, getWhenLastSeen, getWhenLastSeenDate, getWhereLastSeen, getWhereLastSeenName, isClone, isLocationUnknown, isOutOfService, isSelected, reset, setBlocking, setBuilt, setClone, setCloneOrder, setColor, setComment, setDestination, setDestination, setDestination, setDestinationTrack, setDivision, setIdTag, setLastDate, setLastDate, setLastLocationId, setLastRouteId, setLastTrackId, setLastTrain, setLocation, setLocation, setLocationUnknown, setMoves, setNumber, setOutOfService, setOwnerName, setPickupTime, setRfid, setRoadName, setRouteDestination, setRouteLocation, setSelected, setSetoutTime, setTrack, setTrain, setValue, setWeight, store, testLocation, toStringMethods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
NCE_REAR_BLOCK_NUMBER
- See Also:
-
B_UNIT_BLOCKING
- See Also:
-
HP_CHANGED_PROPERTY
- See Also:
-
engineModels
-
verboseStore
boolean verboseStore
-
-
Constructor Details
-
Engine
-
Engine
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-engines.dtd- Parameters:
e- Engine XML element
-
-
Method Details
-
setModel
Set the locomotive's model. Note a model has only one length, type, and horsepower rating.- Parameters:
model- The string model name.
-
getModel
-
setTypeName
Set the locomotive type for this locomotive's model- Overrides:
setTypeNamein classRollingStock- Parameters:
type- Locomotive type: Steam, Diesel, Gas Turbine, etc.
-
getTypeName
- Overrides:
getTypeNamein classRollingStock
-
setHp
Set the locomotive horsepower rating for this locomotive's model- Parameters:
hp- locomotive horsepower
-
getHp
-
getHpInteger
-
setLength
Set the locomotive length for this locomotive's model- Overrides:
setLengthin classRollingStock- Parameters:
length- locomotive length- See Also:
-
getLength
Description copied from class:RollingStockgets the body length of the rolling stock- Overrides:
getLengthin classRollingStock- Returns:
- length in feet or meters
- See Also:
-
setWeightTons
Set the locomotive weight for this locomotive's model- Overrides:
setWeightTonsin classRollingStock- Parameters:
weight- locomotive weight
-
getWeightTons
- Overrides:
getWeightTonsin classRollingStock
-
setBunit
-
isBunit
-
setConsist
Place locomotive in a consist- Parameters:
consist- The Consist to use.
-
getConsist
Get the consist for this locomotive- Returns:
- null if locomotive isn't in a consist
-
getConsistName
-
getBlocking
B units that aren't part of a consist are blocked at the end.- Overrides:
getBlockingin classRollingStock
-
isLead
Used to determine if engine is lead engine in a consist- Returns:
- true if lead engine in a consist
-
getDccAddress
Get the DCC address for this engine from the JMRI roster. Does 4 attempts, 1st by road and number, 2nd by number, 3rd by dccAddress using the engine's road number, 4th by id.- Returns:
- dccAddress
-
getRosterEntry
Get the RosterEntry for this engine from the JMRI roster. Does 4 attempts, 1st by road and number, 2nd by number, 3rd by dccAddress using the engine's road number, 4th by id.- Returns:
- RosterEntry, can be null
-
checkDestination
Used to check destination track to see if it will accept locomotive- Overrides:
checkDestinationin classRollingStock- Parameters:
destination- The Location.track- The Track at destination.- Returns:
- status, see RollingStock.java
-
moveRollingStock
Determine if there's a change in the lead locomotive. There are two possible locations in a train's route. TODO this code places the last loco added to the train as the lead. It would be better if the first one became the lead loco.- Overrides:
moveRollingStockin classRollingStock
-
dispose
Description copied from class:RollingStockRemove rolling stock. Releases all listeners.- Overrides:
disposein classRollingStock
-
store
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-engines.dtd.- Returns:
- Contents in a JDOM Element
-
setDirtyAndFirePropertyChange
- Overrides:
setDirtyAndFirePropertyChangein classRollingStock
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classRollingStock
-