Class TimeTableCsvImport


  • public class TimeTableCsvImport
    extends java.lang.Object
    CSV Record Types. The first field is the record type keyword (not I18N). Most fields are optional.
     "Layout", "layout name", "scale", fastClock, throttles, "metric"
                Defaults:  "New Layout", "HO", 4, 0, "No"
                Occurs:  Must be first record, occurs once
    
     "TrainType", "type name", color number
                Defaults: "New Type", #000000
                Occurs:  Follows Layout record, occurs 0 to n times.  If none, a default train type is created which will be used for all trains.
                Notes:  #000000 is black.
                        If the type name is UseLayoutTypes, the train types for the current layout will be used.
    
     "Segment", "segment name"
                Default: "New Segment"
                Occurs: Follows last TrainType, if any.  Occurs 1 to n times.
    
     "Station", "station name", distance, doubleTrack, sidings, staging
                Defaults: "New Station", 1.0, No, 0, 0
                Occurs:  Follows parent segment, occurs 1 to n times.
                Note:  If the station name is UseSegmentStations, the stations for the current segment will be used.
    
     "Schedule", "schedule name", "effective date", startHour, duration
                Defaults:  "New Schedule", "Today", 0, 24
                Occurs: Follows last station, occurs 1 to n times.
    
     "Train", "train name", "train description", type, defaultSpeed, starttime, throttle, notes
                Defaults:  "NT", "New Train", 0, 1, 0, 0, ""
                Occurs:  Follows parent schedule, occurs 1 to n times.
                Note1:  The type is the relative number of the train type listed above starting with 1 for the first train type.
                Note2:  The start time is an integer between 0 and 1439, subject to the schedule start time and duration.
    
     "Stop", station, duration, nextSpeed, stagingTrack, notes
                Defaults:  0, 0, 0, 0, ""
                Required: station number.
                Occurs:  Follows parent train in the proper sequence.  Occurs 1 to n times.
                Notes:  The station is the relative number of the station listed above starting with 1 for the first station.
                        If more that one segment is used, the station number is cumulative.
    
     Except for Stops, each record can have one of three actions:
        1) If no name is supplied, a default object will be created.
        2) If the name matches an existing name, the existing object will be used.
        3) A new object will be created with the supplied name.  The remaining fields, if any, will replace the default values.
    
     Minimal file using defaults except for station names and distances:
     "Layout"
     "Segment"
     "Station", "Station 1", 0.0
     "Station", "Station 2", 25.0
     "Schedule"
     "Train"
     "Stop", 1
     "Stop", 2
     
    The import applies the changes to the data in memory. At the end of the import a dialog is displayed with the option to save the changes to the timetable data file.
    Since:
    4.15.3
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) double convertToDouble​(java.lang.String number)  
      (package private) int convertToInteger​(java.lang.String number)  
      (package private) void doLayout​(java.lang.String[] values)  
      (package private) void doSchedule​(java.lang.String[] values)  
      (package private) void doSegment​(java.lang.String[] values)  
      (package private) void doStation​(java.lang.String[] values)  
      (package private) void doStop​(java.lang.String[] values)  
      (package private) void doTrain​(java.lang.String[] values)  
      (package private) void doTrainType​(java.lang.String[] values)  
      java.util.List<java.lang.String> importCsv​(java.io.File file)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait