Class RollingStockManager<T extends RollingStock>
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.rollingstock.RollingStockManager<T>
-
- Type Parameters:
T- the type of RollingStock managed by this manager
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider
- Direct Known Subclasses:
CarManager,EngineManager
public abstract class RollingStockManager<T extends RollingStock> extends PropertyChangeSupport implements java.beans.PropertyChangeListener
Base class for rolling stock managers car and engine.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Hashtable<java.lang.String,T>_hashTableprotected static intBY_BLOCKINGprotected static intBY_BUILTprotected static intBY_COLORprotected static intBY_COMMENTprotected static intBY_DESTINATIONprotected static intBY_LASTprotected static intBY_LOCATIONprotected static intBY_MOVESprotected static intBY_NUMBERprotected static intBY_OWNERprotected static intBY_RFIDprotected static intBY_ROADprotected static intBY_TRAINprotected static intBY_TYPEprotected static intBY_VALUEstatic java.lang.StringLISTLENGTH_CHANGED_PROPERTYstatic java.lang.StringNONE-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description RollingStockManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.lang.StringconvertBuildDate(java.lang.String date)voiddeleteAll()Remove all RollingStock from rostervoidderegister(T rs)Unload RollingStock.voiddispose()java.util.List<T>getByBuiltList()Sort by when rolling stock was builtjava.util.List<T>getByColorList()Sort by rolling stock color namesjava.util.List<T>getByCommentList()java.util.List<T>getByDestinationList()Sort by rolling stock destinationTgetById(java.lang.String id)Get rolling stock by idjava.util.List<T>getByIdList()Sort by rolling stock idjava.util.List<T>getByLastDateList()Get a list of all rolling stock sorted last date usedjava.util.List<T>getByLastDateList(java.util.List<T> inList)Sort a specific list of rolling stock last date usedprotected java.util.List<T>getByList(java.util.List<T> sortIn, int attribute)java.util.List<T>getByLocationList()Sort by rolling stock locationjava.util.List<T>getByMovesList()Sort by rolling stock movesjava.util.List<T>getByNumberList()Sort by rolling stock number, number can be alphanumeric.java.util.List<T>getByOwnerList()Sort by rolling stock ownerTgetByRfid(java.lang.String rfid)Get a rolling stock by Radio Frequency Identification (RFID)java.util.List<T>getByRfidList()Sort by rolling stock RFIDTgetByRoadAndNumber(java.lang.String road, java.lang.String number)Get rolling stock by road and numberjava.util.List<T>getByRoadNameList()Sort by rolling stock road namejava.util.List<T>getByTrainList()Sort by rolling stocks in trainsjava.util.List<T>getByTrainList(Train train)Get a list of rolling stocks assigned to a train ordered by locationTgetByTypeAndRoad(java.lang.String type, java.lang.String road)Get a rolling stock by type and road.java.util.List<T>getByTypeList()Sort by rolling stock type namesjava.util.List<T>getByTypeList(java.lang.String type)Return rolling stock of a specific typejava.util.List<T>getByValueList()Sort by rolling stock valueprotected java.util.Comparator<T>getComparator(int attribute)java.util.List<T>getList()Returns a list (no order) of RollingStock.java.util.List<T>getList(Location location)Returns a list (no order) of RollingStock at a location.java.util.List<T>getList(Track track)Returns a list (no order) of RollingStock on a track.java.util.List<T>getList(Train train)Returns a list (no order) of RollingStock in a train.intgetNumEntries()Get the number of items in the rosterabstract RollingStocknewRS(java.lang.String road, java.lang.String number)voidpropertyChange(java.beans.PropertyChangeEvent evt)voidregister(T rs)Load RollingStock.voidresetMoves()voidresetMoves(java.util.List<T> list)-
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
-
_hashTable
protected java.util.Hashtable<java.lang.String,T extends RollingStock> _hashTable
-
LISTLENGTH_CHANGED_PROPERTY
public static final java.lang.String LISTLENGTH_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
BY_NUMBER
protected static final int BY_NUMBER
- See Also:
- Constant Field Values
-
BY_ROAD
protected static final int BY_ROAD
- See Also:
- Constant Field Values
-
BY_TYPE
protected static final int BY_TYPE
- See Also:
- Constant Field Values
-
BY_COLOR
protected static final int BY_COLOR
- See Also:
- Constant Field Values
-
BY_LOCATION
protected static final int BY_LOCATION
- See Also:
- Constant Field Values
-
BY_DESTINATION
protected static final int BY_DESTINATION
- See Also:
- Constant Field Values
-
BY_TRAIN
protected static final int BY_TRAIN
- See Also:
- Constant Field Values
-
BY_MOVES
protected static final int BY_MOVES
- See Also:
- Constant Field Values
-
BY_BUILT
protected static final int BY_BUILT
- See Also:
- Constant Field Values
-
BY_OWNER
protected static final int BY_OWNER
- See Also:
- Constant Field Values
-
BY_RFID
protected static final int BY_RFID
- See Also:
- Constant Field Values
-
BY_VALUE
protected static final int BY_VALUE
- See Also:
- Constant Field Values
-
BY_LAST
protected static final int BY_LAST
- See Also:
- Constant Field Values
-
BY_BLOCKING
protected static final int BY_BLOCKING
- See Also:
- Constant Field Values
-
BY_COMMENT
protected static final int BY_COMMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RollingStockManager
public RollingStockManager()
-
-
Method Detail
-
newRS
public abstract RollingStock newRS(java.lang.String road, java.lang.String number)
-
getNumEntries
public int getNumEntries()
Get the number of items in the roster- Returns:
- Number of rolling stock in the Roster
-
dispose
public void dispose()
-
getById
public T getById(java.lang.String id)
Get rolling stock by id- Parameters:
id- The string id.- Returns:
- requested RollingStock object or null if none exists
-
getByRoadAndNumber
public T getByRoadAndNumber(java.lang.String road, java.lang.String number)
Get rolling stock by road and number- Parameters:
road- RollingStock roadnumber- RollingStock number- Returns:
- requested RollingStock object or null if none exists
-
getByTypeAndRoad
public T getByTypeAndRoad(java.lang.String type, java.lang.String road)
Get a rolling stock by type and road. Used to test that rolling stock with a specific type and road exists.- Parameters:
type- RollingStock type.road- RollingStock road.- Returns:
- the first RollingStock found with the specified type and road.
-
getByRfid
public T getByRfid(java.lang.String rfid)
Get a rolling stock by Radio Frequency Identification (RFID)- Parameters:
rfid- RollingStock's RFID.- Returns:
- the RollingStock with the specific RFID, or null if not found
-
deregister
public void deregister(T rs)
Unload RollingStock.- Parameters:
rs- The RollingStock to delete.
-
deleteAll
public void deleteAll()
Remove all RollingStock from roster
-
resetMoves
public void resetMoves()
-
resetMoves
public void resetMoves(java.util.List<T> list)
-
getList
public java.util.List<T> getList()
Returns a list (no order) of RollingStock.- Returns:
- list of RollingStock
-
getByIdList
public java.util.List<T> getByIdList()
Sort by rolling stock id- Returns:
- list of RollingStock ordered by id
-
getByRoadNameList
public java.util.List<T> getByRoadNameList()
Sort by rolling stock road name- Returns:
- list of RollingStock ordered by road name
-
getByNumberList
public java.util.List<T> getByNumberList()
Sort by rolling stock number, number can be alphanumeric. RollingStock number can also be in the format of nnnn-N, where the "-N" allows the user to enter RollingStock with similar numbers.- Returns:
- list of RollingStock ordered by number
-
getByTypeList
public java.util.List<T> getByTypeList()
Sort by rolling stock type names- Returns:
- list of RollingStock ordered by RollingStock type
-
getByTypeList
public java.util.List<T> getByTypeList(java.lang.String type)
Return rolling stock of a specific type- Parameters:
type- type of rolling stock- Returns:
- list of RollingStock that are specific type
-
getByColorList
public java.util.List<T> getByColorList()
Sort by rolling stock color names- Returns:
- list of RollingStock ordered by RollingStock color
-
getByLocationList
public java.util.List<T> getByLocationList()
Sort by rolling stock location- Returns:
- list of RollingStock ordered by RollingStock location
-
getByDestinationList
public java.util.List<T> getByDestinationList()
Sort by rolling stock destination- Returns:
- list of RollingStock ordered by RollingStock destination
-
getByTrainList
public java.util.List<T> getByTrainList()
Sort by rolling stocks in trains- Returns:
- list of RollingStock ordered by trains
-
getByMovesList
public java.util.List<T> getByMovesList()
Sort by rolling stock moves- Returns:
- list of RollingStock ordered by RollingStock moves
-
getByBuiltList
public java.util.List<T> getByBuiltList()
Sort by when rolling stock was built- Returns:
- list of RollingStock ordered by RollingStock built date
-
getByOwnerList
public java.util.List<T> getByOwnerList()
Sort by rolling stock owner- Returns:
- list of RollingStock ordered by RollingStock owner
-
getByValueList
public java.util.List<T> getByValueList()
Sort by rolling stock value- Returns:
- list of RollingStock ordered by value
-
getByRfidList
public java.util.List<T> getByRfidList()
Sort by rolling stock RFID- Returns:
- list of RollingStock ordered by RFIDs
-
getByLastDateList
public java.util.List<T> getByLastDateList()
Get a list of all rolling stock sorted last date used- Returns:
- list of RollingStock ordered by last date
-
getByCommentList
public java.util.List<T> getByCommentList()
-
getByLastDateList
public java.util.List<T> getByLastDateList(java.util.List<T> inList)
Sort a specific list of rolling stock last date used- Parameters:
inList- list of rolling stock to sort.- Returns:
- list of RollingStock ordered by last date
-
getComparator
protected java.util.Comparator<T> getComparator(int attribute)
-
convertBuildDate
public static java.lang.String convertBuildDate(java.lang.String date)
-
getByTrainList
public java.util.List<T> getByTrainList(Train train)
Get a list of rolling stocks assigned to a train ordered by location- Parameters:
train- The Train.- Returns:
- List of RollingStock assigned to the train ordered by location
-
getList
public java.util.List<T> getList(Train train)
Returns a list (no order) of RollingStock in a train.- Parameters:
train- The Train.- Returns:
- list of RollingStock
-
getList
public java.util.List<T> getList(Location location)
Returns a list (no order) of RollingStock at a location.- Parameters:
location- location to search for.- Returns:
- list of RollingStock
-
getList
public java.util.List<T> getList(Track track)
Returns a list (no order) of RollingStock on a track.- Parameters:
track- Track to search for.- Returns:
- list of RollingStock
-
propertyChange
@OverridingMethodsMustInvokeSuper public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
-