001package jmri.jmrit.ctc.ctcserialdata;
002
003import java.util.HashMap;
004import javax.swing.ButtonGroup;
005import jmri.jmrit.ctc.NBHSensor;
006
007/**
008 *
009 * @author Gregory J. Bedlek Copyright (C) 2018, 2019
010 */
011public class OtherData {
012    public final static String CTC_VERSION = "v2.0";
013
014    public enum CTC_PANEL_TYPE {
015// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
016// gotten by calling "CommonSubs.getButtonSelectedInt".
017        USS(0), OTHER(1);
018        private final int _mRadioGroupValue;
019        private final static HashMap<Integer, CTC_PANEL_TYPE> map = new HashMap<>();
020        private CTC_PANEL_TYPE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
021        static { for (CTC_PANEL_TYPE value : CTC_PANEL_TYPE.values()) { map.put(value._mRadioGroupValue, value); }}
022        public int getRadioGroupValue() { return _mRadioGroupValue; }
023        public static CTC_PANEL_TYPE getRadioGroupValue(int radioGroupValue) { return map.get(radioGroupValue); }
024    }
025
026    public enum SIGNALS_ON_PANEL {
027// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
028// gotten by calling "CommonSubs.getButtonSelectedInt".
029        ALL(0), GREEN_OFF(1), NONE(2);
030        private final int _mRadioGroupValue;
031        private final static HashMap<Integer, SIGNALS_ON_PANEL> map = new HashMap<>();
032        private SIGNALS_ON_PANEL (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
033        static { for (SIGNALS_ON_PANEL value : SIGNALS_ON_PANEL.values()) { map.put(value._mRadioGroupValue, value); }}
034        public int getRadioGroupValue() { return _mRadioGroupValue; }
035        public static SIGNALS_ON_PANEL getRadioGroupValue(int radioGroupValue) { return map.get(radioGroupValue); }
036    }
037
038    public enum VERTICAL_SIZE {
039// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
040// gotten by calling "CommonSubs.getButtonSelectedInt".
041        SMALL(0), MEDIUM(1), LARGE(2);
042        private final int _mRadioGroupValue;
043        private final static HashMap<Integer, VERTICAL_SIZE> map = new HashMap<>();
044        private VERTICAL_SIZE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
045        static { for (VERTICAL_SIZE value : VERTICAL_SIZE.values()) { map.put(value._mRadioGroupValue, value); }}
046        public int getRadioGroupValue() { return _mRadioGroupValue; }
047        public static VERTICAL_SIZE getRadioGroupValue(int radioGroupValue) { return map.get(radioGroupValue); }
048    }
049
050    public enum SIGNAL_SYSTEM_TYPE {
051// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
052// gotten by calling "CommonSubs.getButtonSelectedInt".
053        SIGNALHEAD(0), SIGNALMAST(1);
054        private final int _mRadioGroupValue;
055        private final static HashMap<Integer, SIGNAL_SYSTEM_TYPE> map = new HashMap<>();
056        private SIGNAL_SYSTEM_TYPE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
057        static { for (SIGNAL_SYSTEM_TYPE value : SIGNAL_SYSTEM_TYPE.values()) { map.put(value._mRadioGroupValue, value); }}
058        public int getInt() { return _mRadioGroupValue; }
059        public static SIGNAL_SYSTEM_TYPE getSignalSystemType(int radioGroupValue) { return map.get(radioGroupValue); }
060        public static SIGNAL_SYSTEM_TYPE getSignalSystemType(ButtonGroup buttonGroup) { return map.get(ProjectsCommonSubs.getButtonSelectedInt(buttonGroup)); }
061    }
062
063//  Fleeting:
064    public NBHSensor   _mFleetingToggleInternalSensor;
065    public boolean  _mDefaultFleetingEnabled;
066//  Global startup:
067    public boolean  _mTUL_EnabledAtStartup = true;
068    public SIGNAL_SYSTEM_TYPE _mSignalSystemType;
069    public int      _mTUL_SecondsToLockTurnouts = 0;
070//  Next unique # for each created Column:
071    public int      _mNextUniqueNumber = 0;
072//  CTC Debugging:
073    public NBHSensor   _mCTCDebugSystemReloadInternalSensor;
074    public NBHSensor   _mCTCDebug_TrafficLockingRuleTriggeredDisplayInternalSensor;
075//  GUI design:
076    public int      _mGUIDesign_NumberOfEmptyColumnsAtEnd;
077    public CTC_PANEL_TYPE   _mGUIDesign_CTCPanelType;
078    public boolean  _mGUIDesign_BuilderPlate;
079    public SIGNALS_ON_PANEL _mGUIDesign_SignalsOnPanel;
080    public boolean  _mGUIDesign_FleetingToggleSwitch;
081    public boolean  _mGUIDesign_AnalogClockEtc;
082    public boolean  _mGUIDesign_ReloadCTCSystemButton;
083    public boolean  _mGUIDesign_CTCDebugOnToggle;
084    public boolean  _mGUIDesign_CreateTrackPieces;
085    public VERTICAL_SIZE _mGUIDesign_VerticalSize;
086    public boolean  _mGUIDesign_OSSectionUnknownInconsistentRedBlink;
087    public boolean  _mGUIDesign_TurnoutsOnPanel;
088
089    public OtherData() {
090        _mFleetingToggleInternalSensor = new NBHSensor("OtherData", "fleeting = ", "IS:FLEETING", "IS:FLEETING");  // NOI18N
091        _mDefaultFleetingEnabled = false;
092        _mSignalSystemType = SIGNAL_SYSTEM_TYPE.SIGNALMAST;
093        _mCTCDebugSystemReloadInternalSensor = new NBHSensor("OtherData", "reload = ", "IS:RELOADCTC", "IS:RELOADCTC");  // NOI18N
094        _mCTCDebug_TrafficLockingRuleTriggeredDisplayInternalSensor = new NBHSensor("OtherData", "debug = ", "IS:DEBUGCTC", "IS:DEBUGCTC");  // NOI18N
095        _mGUIDesign_NumberOfEmptyColumnsAtEnd = 0;
096        _mGUIDesign_CTCPanelType = CTC_PANEL_TYPE.USS;
097        _mGUIDesign_BuilderPlate = false;
098        _mGUIDesign_SignalsOnPanel = SIGNALS_ON_PANEL.ALL;
099        _mGUIDesign_FleetingToggleSwitch = true;
100        _mGUIDesign_AnalogClockEtc = false;
101        _mGUIDesign_ReloadCTCSystemButton = true;
102        _mGUIDesign_CTCDebugOnToggle = true;
103        _mGUIDesign_CreateTrackPieces = false;
104        _mGUIDesign_VerticalSize = VERTICAL_SIZE.SMALL;
105        _mGUIDesign_OSSectionUnknownInconsistentRedBlink = false;
106        _mGUIDesign_TurnoutsOnPanel = true;
107    }
108
109    public int getNextUniqueNumber() { return _mNextUniqueNumber++; }
110
111    public void possiblySetToHighest(int value) { if (value + 1 > _mNextUniqueNumber) _mNextUniqueNumber = value + 1; }
112
113}