Class EngineManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.rollingstock.RollingStockManager<Engine>
-
- jmri.jmrit.operations.rollingstock.engines.EngineManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,InstanceManagerAutoDefault
,InstanceManagerAutoInitialize
public class EngineManager extends RollingStockManager<Engine> implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize
Manages the engines.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
_commentLength
-
Fields inherited from class jmri.jmrit.operations.rollingstock.RollingStockManager
_hashTable, BY_BLOCKING, BY_BUILT, BY_COLOR, BY_COMMENT, BY_DESTINATION, BY_LAST, BY_LOCATION, BY_MOVES, BY_NUMBER, BY_OWNER, BY_RFID, BY_ROAD, BY_TRAIN, BY_TYPE, BY_VALUE, LISTLENGTH_CHANGED_PROPERTY, NONE
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description EngineManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregister(Engine engine)
Unload RollingStock.java.util.List<Engine>
getAvailableTrainList(Train train)
return a list available engines (no assigned train) engines are ordered least recently moved to most recently moved.java.util.List<Engine>
getByConsistList()
Sort by engine consistjava.util.List<Engine>
getByHpList()
java.util.List<Engine>
getByModelList()
Sort by engine modeljava.util.List<Engine>
getByTrainBlockingList(Train train)
Returns a list of locos sorted by blocking number for a train.protected java.util.Comparator<Engine>
getComparator(int attribute)
java.util.List<java.lang.String>
getEngineRoadNames(java.lang.String model)
Get a list of engine road names.int
getMaxCommentLength()
void
initialize()
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.void
load(org.jdom2.Element root)
Engine
newRS(java.lang.String engineRoad, java.lang.String engineNumber)
Finds an existing engine or creates a new engine if needed requires engine's road and numbervoid
propertyChange(java.beans.PropertyChangeEvent evt)
protected void
setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
void
store(org.jdom2.Element root)
Create an XML element to represent this Entry.void
updateEngineRoadComboBox(java.lang.String engineModel, javax.swing.JComboBox<java.lang.String> roadEngineBox)
-
Methods inherited from class jmri.jmrit.operations.rollingstock.RollingStockManager
convertBuildDate, deleteAll, dispose, getByBuiltList, getByColorList, getByCommentList, getByDestinationList, getById, getByIdList, getByLastDateList, getByLastDateList, getByList, getByLocationList, getByMovesList, getByNumberList, getByOwnerList, getByRfid, getByRfidList, getByRoadAndNumber, getByRoadNameList, getByTrainList, getByTrainList, getByTypeAndRoad, getByTypeList, getByTypeList, getByValueList, getList, getList, getList, getList, getNumEntries, register, resetMoves, resetMoves
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
_commentLength
int _commentLength
-
-
Constructor Detail
-
EngineManager
public EngineManager()
-
-
Method Detail
-
newRS
public Engine newRS(java.lang.String engineRoad, java.lang.String engineNumber)
Finds an existing engine or creates a new engine if needed requires engine's road and number- Specified by:
newRS
in classRollingStockManager<Engine>
- Parameters:
engineRoad
- The engine's road initialsengineNumber
- The engine's road number- Returns:
- new engine or existing engine
-
deregister
public void deregister(Engine engine)
Description copied from class:RollingStockManager
Unload RollingStock.- Overrides:
deregister
in classRollingStockManager<Engine>
- Parameters:
engine
- The RollingStock to delete.
-
getByModelList
public java.util.List<Engine> getByModelList()
Sort by engine model- Returns:
- list of engines ordered by engine model
-
getByConsistList
public java.util.List<Engine> getByConsistList()
Sort by engine consist- Returns:
- list of engines ordered by engine consist
-
getByHpList
public java.util.List<Engine> getByHpList()
-
getComparator
protected java.util.Comparator<Engine> getComparator(int attribute)
- Overrides:
getComparator
in classRollingStockManager<Engine>
-
getAvailableTrainList
public java.util.List<Engine> getAvailableTrainList(Train train)
return a list available engines (no assigned train) engines are ordered least recently moved to most recently moved.- Parameters:
train
- The Train requesting this list.- Returns:
- Ordered list of engines not assigned to a train
-
getByTrainBlockingList
public java.util.List<Engine> getByTrainBlockingList(Train train)
Returns a list of locos sorted by blocking number for a train. This returns a list of consisted locos in the order that they were entered in.- Parameters:
train
- The Train requesting this list.- Returns:
- A list of sorted locos.
-
getEngineRoadNames
public java.util.List<java.lang.String> getEngineRoadNames(java.lang.String model)
Get a list of engine road names.- Parameters:
model
- The string model name, can be NONE.- Returns:
- List of engine road names.
-
updateEngineRoadComboBox
public void updateEngineRoadComboBox(java.lang.String engineModel, javax.swing.JComboBox<java.lang.String> roadEngineBox)
-
getMaxCommentLength
public int getMaxCommentLength()
-
load
public void load(org.jdom2.Element root)
-
store
public void store(org.jdom2.Element root)
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-engines.dtd.- Parameters:
root
- The common Element for operations-engines.dtd.
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Overrides:
propertyChange
in classRollingStockManager<Engine>
-
initialize
public void initialize()
Description copied from interface:InstanceManagerAutoInitialize
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initialize
in interfaceInstanceManagerAutoInitialize
-
-