Class RollingStockManager<T extends RollingStock>

    • 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
      • 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 road
        number - 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
      • 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​(java.util.List<T> list)
      • getList

        public java.util.List<TgetList()
        Returns a list (no order) of RollingStock.
        Returns:
        list of RollingStock
      • getByIdList

        public java.util.List<TgetByIdList()
        Sort by rolling stock id
        Returns:
        list of RollingStock ordered by id
      • getByRoadNameList

        public java.util.List<TgetByRoadNameList()
        Sort by rolling stock road name
        Returns:
        list of RollingStock ordered by road name
      • getByNumberList

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

        public java.util.List<TgetByTypeList​(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<TgetByColorList()
        Sort by rolling stock color names
        Returns:
        list of RollingStock ordered by RollingStock color
      • getByLocationList

        public java.util.List<TgetByLocationList()
        Sort by rolling stock location
        Returns:
        list of RollingStock ordered by RollingStock location
      • getByDestinationList

        public java.util.List<TgetByDestinationList()
        Sort by rolling stock destination
        Returns:
        list of RollingStock ordered by RollingStock destination
      • getByTrainList

        public java.util.List<TgetByTrainList()
        Sort by rolling stocks in trains
        Returns:
        list of RollingStock ordered by trains
      • getByMovesList

        public java.util.List<TgetByMovesList()
        Sort by rolling stock moves
        Returns:
        list of RollingStock ordered by RollingStock moves
      • getByBuiltList

        public java.util.List<TgetByBuiltList()
        Sort by when rolling stock was built
        Returns:
        list of RollingStock ordered by RollingStock built date
      • getByOwnerList

        public java.util.List<TgetByOwnerList()
        Sort by rolling stock owner
        Returns:
        list of RollingStock ordered by RollingStock owner
      • getByValueList

        public java.util.List<TgetByValueList()
        Sort by rolling stock value
        Returns:
        list of RollingStock ordered by value
      • getByRfidList

        public java.util.List<TgetByRfidList()
        Sort by rolling stock RFID
        Returns:
        list of RollingStock ordered by RFIDs
      • getByLastDateList

        public java.util.List<TgetByLastDateList()
        Get a list of all rolling stock sorted last date used
        Returns:
        list of RollingStock ordered by last date
      • getByLastDateList

        public java.util.List<TgetByLastDateList​(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
      • getByList

        protected java.util.List<TgetByList​(java.util.List<T> sortIn,
                                              int attribute)
      • getComparator

        protected java.util.Comparator<TgetComparator​(int attribute)
      • convertBuildDate

        public static java.lang.String convertBuildDate​(java.lang.String date)
      • getByTrainList

        public java.util.List<TgetByTrainList​(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<TgetList​(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<TgetList​(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<TgetList​(Track track)
        Returns a list (no order) of RollingStock on a track.
        Parameters:
        track - Track to search for.
        Returns:
        list of RollingStock