Class Train


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

      • Train

        public Train​(int scheduleId)
        Create a new train with default values.
        Parameters:
        scheduleId - The parent schedule id.
        Throws:
        java.lang.IllegalArgumentException - TRAIN_ADD_FAIL
      • Train

        public Train​(int trainId,
                     int scheduleId,
                     int typeId,
                     java.lang.String trainName,
                     java.lang.String trainDesc,
                     int defaultSpeed,
                     int startTime,
                     int throttle,
                     int routeDuration,
                     java.lang.String trainNotes)
    • Method Detail

      • getCopy

        public Train getCopy​(int schedId,
                             int typeId)
        Make a copy of the train.
        Parameters:
        schedId - The new schedule id, if zero use the current schedule id.
        typeId - The new train type id. If zero use the current train type id.
        Returns:
        a new Train instance.
      • setTypeId

        public void setTypeId​(int newType)
      • setTrainName

        public void setTrainName​(java.lang.String newName)
      • setTrainDesc

        public void setTrainDesc​(java.lang.String newDesc)
      • setStartTime

        public void setStartTime​(int newStartTime)
      • setThrottle

        public void setThrottle​(int newThrottle)
      • setTrainNotes

        public void setTrainNotes​(java.lang.String newNotes)
      • toString

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