001package jmri.jmrit.ctc.ctcserialdata;
002
003import java.util.ArrayList;
004
005/**
006 *
007 * @author Gregory J. Bedlek Copyright (C) 2018, 2019
008 */
009public class TrafficLockingEntry {
010    public String _mUserRuleNumber;
011    public String _mRuleEnabled;
012    public final String _mDestinationSignalOrComment;
013    public String _mUserText1;
014    public final String _mSwitchAlignment1;
015    public String _mUserText2;
016    public final String _mSwitchAlignment2;
017    public String _mUserText3;
018    public final String _mSwitchAlignment3;
019    public String _mUserText4;
020    public final String _mSwitchAlignment4;
021    public String _mUserText5;
022    public final String _mSwitchAlignment5;
023    public final String _mOccupancyExternalSensor1;
024    public final String _mOccupancyExternalSensor2;
025    public final String _mOccupancyExternalSensor3;
026    public final String _mOccupancyExternalSensor4;
027    public final String _mOccupancyExternalSensor5;
028    public final String _mOccupancyExternalSensor6;
029    public final String _mOccupancyExternalSensor7;
030    public final String _mOccupancyExternalSensor8;
031    public final String _mOccupancyExternalSensor9;
032    public final String _mOptionalExternalSensor1;
033    public final String _mOptionalExternalSensor2;
034    public String _mUniqueID1;
035    public String _mUniqueID2;
036    public String _mUniqueID3;
037    public String _mUniqueID4;
038    public String _mUniqueID5;
039
040    private static final int USER_RULE_NUMBER_INDEX = 0;
041    private static final int RULE_ENABLED_INDEX = 1;
042    private static final int DESTINATION_SIGNAL_OR_COMMENT_INDEX = 2;
043//  Unused index 3 (was terminating O.S. section info)
044    private static final int USER_TEXT1_INDEX = 4;
045    private static final int SWITCH_ALIGNMENT1_INDEX = 5;
046    private static final int USER_TEXT2_INDEX = 6;
047    private static final int SWITCH_ALIGNMENT2_INDEX = 7;
048    private static final int USER_TEXT3_INDEX = 8;
049    private static final int SWITCH_ALIGNMENT3_INDEX = 9;
050    private static final int USER_TEXT4_INDEX = 10;
051    private static final int SWITCH_ALIGNMENT4_INDEX = 11;
052    private static final int USER_TEXT5_INDEX = 12;
053    private static final int SWITCH_ALIGNMENT5_INDEX = 13;
054    private static final int OCCUPANCY_EXTERNAL_SENSOR1_INDEX  = 14;
055    private static final int OCCUPANCY_EXTERNAL_SENSOR2_INDEX  = 15;
056    private static final int OCCUPANCY_EXTERNAL_SENSOR3_INDEX  = 16;
057    private static final int OCCUPANCY_EXTERNAL_SENSOR4_INDEX  = 17;
058    private static final int OCCUPANCY_EXTERNAL_SENSOR5_INDEX  = 18;
059    private static final int OCCUPANCY_EXTERNAL_SENSOR6_INDEX  = 19;
060    private static final int OCCUPANCY_EXTERNAL_SENSOR7_INDEX  = 20;
061    private static final int OCCUPANCY_EXTERNAL_SENSOR8_INDEX  = 21;
062    private static final int OCCUPANCY_EXTERNAL_SENSOR9_INDEX  = 22;
063    private static final int OPTIONAL_EXTERNAL_SENSOR1_INDEX = 23;
064    private static final int OPTIONAL_EXTERNAL_SENSOR2_INDEX = 24;
065//  Computer maintained:
066//  Unused index 25 (was terminating O.S. section info)
067    private static final int UNIQUE_ID1_INDEX = 26;
068    private static final int UNIQUE_ID2_INDEX = 27;
069    private static final int UNIQUE_ID3_INDEX = 28;
070    private static final int UNIQUE_ID4_INDEX = 29;
071    private static final int UNIQUE_ID5_INDEX = 30;
072    private static final int ARRAY_SIZE = 31;
073
074    public TrafficLockingEntry(String csvString) {
075        ArrayList<String> arrayListOfStrings = ProjectsCommonSubs.getFixedArrayListSizeFromCSV(csvString, ARRAY_SIZE);
076        _mUserRuleNumber = arrayListOfStrings.get(USER_RULE_NUMBER_INDEX);
077        _mRuleEnabled = arrayListOfStrings.get(RULE_ENABLED_INDEX);
078        _mDestinationSignalOrComment = arrayListOfStrings.get(DESTINATION_SIGNAL_OR_COMMENT_INDEX);
079        _mUserText1 = arrayListOfStrings.get(USER_TEXT1_INDEX);
080        _mSwitchAlignment1 = arrayListOfStrings.get(SWITCH_ALIGNMENT1_INDEX);
081        _mUserText2 = arrayListOfStrings.get(USER_TEXT2_INDEX);
082        _mSwitchAlignment2 = arrayListOfStrings.get(SWITCH_ALIGNMENT2_INDEX);
083        _mUserText3 = arrayListOfStrings.get(USER_TEXT3_INDEX);
084        _mSwitchAlignment3 = arrayListOfStrings.get(SWITCH_ALIGNMENT3_INDEX);
085        _mUserText4 = arrayListOfStrings.get(USER_TEXT4_INDEX);
086        _mSwitchAlignment4 = arrayListOfStrings.get(SWITCH_ALIGNMENT4_INDEX);
087        _mUserText5 = arrayListOfStrings.get(USER_TEXT5_INDEX);
088        _mSwitchAlignment5 = arrayListOfStrings.get(SWITCH_ALIGNMENT5_INDEX);
089        _mOccupancyExternalSensor1 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR1_INDEX);
090        _mOccupancyExternalSensor2 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR2_INDEX);
091        _mOccupancyExternalSensor3 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR3_INDEX);
092        _mOccupancyExternalSensor4 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR4_INDEX);
093        _mOccupancyExternalSensor5 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR5_INDEX);
094        _mOccupancyExternalSensor6 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR6_INDEX);
095        _mOccupancyExternalSensor7 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR7_INDEX);
096        _mOccupancyExternalSensor8 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR8_INDEX);
097        _mOccupancyExternalSensor9 = arrayListOfStrings.get(OCCUPANCY_EXTERNAL_SENSOR9_INDEX);
098        _mOptionalExternalSensor1 = arrayListOfStrings.get(OPTIONAL_EXTERNAL_SENSOR1_INDEX);
099        _mOptionalExternalSensor2 = arrayListOfStrings.get(OPTIONAL_EXTERNAL_SENSOR2_INDEX);
100        _mUniqueID1 = arrayListOfStrings.get(UNIQUE_ID1_INDEX);
101        _mUniqueID2 = arrayListOfStrings.get(UNIQUE_ID2_INDEX);
102        _mUniqueID3 = arrayListOfStrings.get(UNIQUE_ID3_INDEX);
103        _mUniqueID4 = arrayListOfStrings.get(UNIQUE_ID4_INDEX);
104        _mUniqueID5 = arrayListOfStrings.get(UNIQUE_ID5_INDEX);
105    }
106}