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:
PropertyChangeListener, EventListener, PropertyChangeFirer, PropertyChangeProvider
Direct Known Subclasses:
CarManager, EngineManager

public abstract class RollingStockManager<T extends RollingStock> extends PropertyChangeSupport implements PropertyChangeListener
Base class for rolling stock managers car and engine.
  • Field Details

  • Constructor Details

  • Method Details

    • newRS

      public abstract RollingStock newRS(String road, 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(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(String road, String number)
      Get rolling stock by road and number
      Parameters:
      road - RollingStock road
      number - RollingStock number
      Returns:
      requested RollingStock object or null if none exists
    • getByTypeAndRoad

      public T getByTypeAndRoad(String type, 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(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
    • register

      public void register(T rs)
      Load RollingStock.
      Parameters:
      rs - The RollingStock to load.
    • 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(List<T> list)
    • getList

      public List<T> getList()
      Returns a list (no order) of RollingStock.
      Returns:
      list of RollingStock
    • getByIdList

      public List<T> getByIdList()
      Sort by rolling stock id
      Returns:
      list of RollingStock ordered by id
    • getByRoadNameList

      Sort by rolling stock road name
      Returns:
      list of RollingStock ordered by road name
    • getByNumberList

      public 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 List<T> getByTypeList()
      Sort by rolling stock type names
      Returns:
      list of RollingStock ordered by RollingStock type
    • getByTypeList

      public List<T> getByTypeList(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 List<T> getByColorList()
      Sort by rolling stock color names
      Returns:
      list of RollingStock ordered by RollingStock color
    • getByLocationList

      Sort by rolling stock location
      Returns:
      list of RollingStock ordered by RollingStock location
    • getByDestinationList

      Sort by rolling stock destination
      Returns:
      list of RollingStock ordered by RollingStock destination
    • getByTrainList

      public List<T> getByTrainList()
      Sort by rolling stocks in trains
      Returns:
      list of RollingStock ordered by trains
    • getByMovesList

      public List<T> getByMovesList()
      Sort by rolling stock moves
      Returns:
      list of RollingStock ordered by RollingStock moves
    • getByBuiltList

      public List<T> getByBuiltList()
      Sort by when rolling stock was built
      Returns:
      list of RollingStock ordered by RollingStock built date
    • getByOwnerList

      public List<T> getByOwnerList()
      Sort by rolling stock owner
      Returns:
      list of RollingStock ordered by RollingStock owner
    • getByValueList

      public List<T> getByValueList()
      Sort by rolling stock value
      Returns:
      list of RollingStock ordered by value
    • getByRfidList

      public List<T> getByRfidList()
      Sort by rolling stock RFID
      Returns:
      list of RollingStock ordered by RFIDs
    • getByLastDateList

      Get a list of all rolling stock sorted last date used
      Returns:
      list of RollingStock ordered by last date
    • getByCommentList

      public List<T> getByCommentList()
    • getByLastDateList

      public List<T> getByLastDateList(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
    • getByList

      protected List<T> getByList(List<T> sortIn, int attribute)
    • getComparator

      protected Comparator<T> getComparator(int attribute)
    • sortByTrackPriority

      protected List<T> sortByTrackPriority(List<T> list)
    • convertBuildDate

      public static String convertBuildDate(String date)
    • getByTrainList

      public 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 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 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 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
    • getClone

      public T getClone(RollingStock rs)
      Returns the rolling stock's last clone rolling stock if there's one.
      Parameters:
      rs - The rolling stock searching for a clone
      Returns:
      Returns the rolling stock's last clone rolling stock, null if there isn't a clone rolling stock.
    • getCloneCreationOrder

      protected int getCloneCreationOrder()
      Returns the highest clone creation order given to a clone.
      Returns:
      1 if the first clone created, otherwise the highest found plus one. Automatically increments.
    • propertyChange

      Specified by:
      propertyChange in interface PropertyChangeListener