Class Station


  • public class Station
    extends java.lang.Object
    Define the content of a Station record.
    • Constructor Detail

      • Station

        public Station​(int segmentId)
        Create a new station with default values.
        Parameters:
        segmentId - The parent segment id.
        Throws:
        java.lang.IllegalArgumentException - STATION_ADD_FAIL
      • Station

        public Station​(int stationId,
                       int segmentId,
                       java.lang.String stationName,
                       double distance,
                       boolean doubleTrack,
                       int sidings,
                       int staging)
    • Method Detail

      • getCopy

        public Station getCopy​(int segmentId)
        Make a copy of the station.
        Parameters:
        segmentId - The new segmentId, if zero use the current segment id.
        Returns:
        a new station instance.
      • setStationName

        public void setStationName​(java.lang.String newName)
      • setDistance

        public void setDistance​(double newDistance)
        Set a new distance.
        Parameters:
        newDistance - The value to be used.
        Throws:
        java.lang.IllegalArgumentException - (DISTANCE_LT_0) if the value is less than 0.0.
      • setDoubleTrack

        public void setDoubleTrack​(boolean newDoubleTrack)
      • setSidings

        public void setSidings​(int newSidings)
        Set a new siding count.
        Parameters:
        newSidings - The value to be used.
        Throws:
        java.lang.IllegalArgumentException - (SIDINGS_LT_0) if the value is less than 0.
      • setStaging

        public void setStaging​(int newStaging)
        Set a new staging track count.
        Parameters:
        newStaging - The value to be used.
        Throws:
        java.lang.IllegalArgumentException - (STAGING_LT_0, STAGING_IN_USE) if the value is less than 0 or a staging track is referenced by a train stop.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object