Package jmri
Class TransitSectionAction
- java.lang.Object
-
- jmri.TransitSectionAction
-
public class TransitSectionAction extends java.lang.Object
This class holds information and options for a Action to be applied when an automated train enters, exits, or is inside of a Section in a Transit.A TransitSection holds specified TrainsitSectionActions. A TransitSection may have as many TransitSectionActions as appropriate. Each TransitSectionAction belongs to one and only one TransitSection.
TransitSectionActions are specified in two parts: 1. The "When" part specifies when after the automated train enters the Section the action is to be initiated. Optionally, each "when" may be delayed by a specified time (in milliseconds). 2. The "What" part specified what action is to occur.
TransitSectionActions are created and edited in the Transit Table, when Transits are defined.
This class provides support for SENSORACTIVE and SENSORINACTIVE "when"'s.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BLOCKENTRY
static int
BLOCKEXIT
static int
ENTRY
static int
ESTOP
static int
EXIT
static int
FORCEALLOCATEPASSSAFESECTION
static int
HOLDSIGNAL
static int
LOADTRAININFO
static int
LOCOADDRESSTYPECURRENT
static int
LOCOADDRESSTYPEDEFAULT
static int
LOCOADDRESSTYPENUMBER
static int
LOCOADDRESSTYPEROSTER
static int
LOCOFUNCTION
static int
NUM_WHATS
static int
NUM_WHENS
Constants representing the "when" (when the action is to be initiated) of the Action.static int
PAUSE
static int
PRESTARTACTION
static int
PRESTARTDELAY
static int
PRESTARTRESUME
static int
RAMPTRAINSPEED
static int
RELEASESIGNAL
static int
SELECTWHAT
Constants designating the "what" (the action to be taken) of the Action.static int
SELECTWHEN
static int
SENSORACTIVE
static int
SENSORINACTIVE
static int
SETCURRENTSPEED
static int
SETLIGHT
static int
SETMAXSPEED
static int
SETSENSORACTIVE
static int
SETSENSORINACTIVE
static int
SOUNDHORN
static int
SOUNDHORNPATTERN
static int
STARTBELL
static int
STOPBELL
static int
TERMINATETRAIN
static int
TOMANUALMODE
static int
TRAINSTART
static int
TRAINSTOP
-
Constructor Summary
Constructors Constructor Description TransitSectionAction(int when, int what)
Create a TransitSectionAction.TransitSectionAction(int when, int what, int dataWhen, int dataWhat1, int dataWhat2, java.lang.String sWhen, java.lang.String sWhat)
Create a TransitSectionAction.TransitSectionAction(int when, int what, int dataWhen, int dataWhat1, int dataWhat2, java.lang.String sWhen, java.lang.String sWhat, java.lang.String sWhat2)
Create a TransitSectionAction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
void
disposeSensorListener()
int
getDataWhat1()
float
getDataWhat1Float()
int
getDataWhat2()
int
getDataWhen()
java.beans.PropertyChangeListener
getSensorListener()
java.lang.String
getStringWhat()
java.lang.String
getStringWhat2()
java.lang.String
getStringWhen()
TransitSection
getTargetTransitSection()
java.lang.Object
getThreadObject()
Sensor
getTriggerSensor()
boolean
getWaitingForBlock()
boolean
getWaitingForSectionExit()
boolean
getWaitingForSensor()
java.lang.Thread
getWaitingThread()
int
getWhatCode()
int
getWhenCode()
void
initialize()
Initialize all operational instance variables (not saved between runs).void
setDataWhat1(int n)
void
setDataWhat1Float(float n)
void
setDataWhat2(int n)
void
setDataWhen(int n)
void
setSensorListener(java.beans.PropertyChangeListener l)
void
setStringWhat(java.lang.String s)
void
setStringWhat2(java.lang.String s)
void
setStringWhen(java.lang.String s)
void
setTargetTransitSection(TransitSection ts)
void
setThreadObject(java.lang.Object threadObj)
void
setTriggerSensor(Sensor s)
void
setWaitingForBlock(boolean w)
void
setWaitingForSectionExit(boolean w)
void
setWaitingForSensor(boolean w)
void
setWaitingThread(java.lang.Thread t)
void
setWhatCode(int n)
void
setWhenCode(int n)
-
-
-
Field Detail
-
NUM_WHENS
public static final int NUM_WHENS
Constants representing the "when" (when the action is to be initiated) of the Action. TODO: Convert to ENUM- See Also:
- Constant Field Values
-
SELECTWHEN
public static final int SELECTWHEN
- See Also:
- Constant Field Values
-
ENTRY
public static final int ENTRY
- See Also:
- Constant Field Values
-
EXIT
public static final int EXIT
- See Also:
- Constant Field Values
-
BLOCKENTRY
public static final int BLOCKENTRY
- See Also:
- Constant Field Values
-
BLOCKEXIT
public static final int BLOCKEXIT
- See Also:
- Constant Field Values
-
TRAINSTOP
public static final int TRAINSTOP
- See Also:
- Constant Field Values
-
TRAINSTART
public static final int TRAINSTART
- See Also:
- Constant Field Values
-
SENSORACTIVE
public static final int SENSORACTIVE
- See Also:
- Constant Field Values
-
SENSORINACTIVE
public static final int SENSORINACTIVE
- See Also:
- Constant Field Values
-
PRESTARTDELAY
public static final int PRESTARTDELAY
- See Also:
- Constant Field Values
-
PRESTARTACTION
public static final int PRESTARTACTION
- See Also:
- Constant Field Values
-
SELECTWHAT
public static final int SELECTWHAT
Constants designating the "what" (the action to be taken) of the Action. TODO: Convert to ENUM- See Also:
- Constant Field Values
-
PAUSE
public static final int PAUSE
- See Also:
- Constant Field Values
-
SETMAXSPEED
public static final int SETMAXSPEED
- See Also:
- Constant Field Values
-
SETCURRENTSPEED
public static final int SETCURRENTSPEED
- See Also:
- Constant Field Values
-
RAMPTRAINSPEED
public static final int RAMPTRAINSPEED
- See Also:
- Constant Field Values
-
TOMANUALMODE
public static final int TOMANUALMODE
- See Also:
- Constant Field Values
-
SETLIGHT
public static final int SETLIGHT
- See Also:
- Constant Field Values
-
STARTBELL
public static final int STARTBELL
- See Also:
- Constant Field Values
-
STOPBELL
public static final int STOPBELL
- See Also:
- Constant Field Values
-
SOUNDHORN
public static final int SOUNDHORN
- See Also:
- Constant Field Values
-
SOUNDHORNPATTERN
public static final int SOUNDHORNPATTERN
- See Also:
- Constant Field Values
-
LOCOFUNCTION
public static final int LOCOFUNCTION
- See Also:
- Constant Field Values
-
SETSENSORACTIVE
public static final int SETSENSORACTIVE
- See Also:
- Constant Field Values
-
SETSENSORINACTIVE
public static final int SETSENSORINACTIVE
- See Also:
- Constant Field Values
-
HOLDSIGNAL
public static final int HOLDSIGNAL
- See Also:
- Constant Field Values
-
RELEASESIGNAL
public static final int RELEASESIGNAL
- See Also:
- Constant Field Values
-
ESTOP
public static final int ESTOP
- See Also:
- Constant Field Values
-
PRESTARTRESUME
public static final int PRESTARTRESUME
- See Also:
- Constant Field Values
-
TERMINATETRAIN
public static final int TERMINATETRAIN
- See Also:
- Constant Field Values
-
LOADTRAININFO
public static final int LOADTRAININFO
- See Also:
- Constant Field Values
-
FORCEALLOCATEPASSSAFESECTION
public static final int FORCEALLOCATEPASSSAFESECTION
- See Also:
- Constant Field Values
-
NUM_WHATS
public static final int NUM_WHATS
- See Also:
- Constant Field Values
-
LOCOADDRESSTYPEDEFAULT
public static final int LOCOADDRESSTYPEDEFAULT
- See Also:
- Constant Field Values
-
LOCOADDRESSTYPEROSTER
public static final int LOCOADDRESSTYPEROSTER
- See Also:
- Constant Field Values
-
LOCOADDRESSTYPENUMBER
public static final int LOCOADDRESSTYPENUMBER
- See Also:
- Constant Field Values
-
LOCOADDRESSTYPECURRENT
public static final int LOCOADDRESSTYPECURRENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TransitSectionAction
public TransitSectionAction(int when, int what)
Create a TransitSectionAction.- Parameters:
when
- one ofENTRY
,EXIT
,BLOCKENTRY
,BLOCKEXIT
,TRAINSTOP
,TRAINSTART
,SENSORACTIVE
,SENSORINACTIVE
,PRESTARTRESUME
what
- one ofPAUSE
,SETMAXSPEED
,SETCURRENTSPEED
,RAMPTRAINSPEED
,TOMANUALMODE
,SETLIGHT
,STARTBELL
,STOPBELL
,SOUNDHORN
,SOUNDHORNPATTERN
,LOCOFUNCTION
,SETSENSORACTIVE
,SETSENSORINACTIVE
,HOLDSIGNAL
,RELEASESIGNAL
-
TransitSectionAction
public TransitSectionAction(int when, int what, int dataWhen, int dataWhat1, int dataWhat2, java.lang.String sWhen, java.lang.String sWhat)
Create a TransitSectionAction.- Parameters:
when
- one ofENTRY
,EXIT
,BLOCKENTRY
,BLOCKEXIT
,TRAINSTOP
,TRAINSTART
,SENSORACTIVE
,SENSORINACTIVE
what
- one ofPAUSE
,SETMAXSPEED
,SETCURRENTSPEED
,RAMPTRAINSPEED
,TOMANUALMODE
,SETLIGHT
,STARTBELL
,STOPBELL
,SOUNDHORN
,SOUNDHORNPATTERN
,LOCOFUNCTION
,SETSENSORACTIVE
,SETSENSORINACTIVE
,HOLDSIGNAL
,RELEASESIGNAL
dataWhen
- a data element for whendataWhat1
- a data element for whatdataWhat2
- a data element for whatsWhen
- typically a readable description of when or the name of the triggering sensorssWhat
- typically a readable description of what
-
TransitSectionAction
public TransitSectionAction(int when, int what, int dataWhen, int dataWhat1, int dataWhat2, java.lang.String sWhen, java.lang.String sWhat, java.lang.String sWhat2)
Create a TransitSectionAction.- Parameters:
when
- one ofENTRY
,EXIT
,BLOCKENTRY
,BLOCKEXIT
,TRAINSTOP
,TRAINSTART
,SENSORACTIVE
,SENSORINACTIVE
what
- one ofPAUSE
,SETMAXSPEED
,SETCURRENTSPEED
,RAMPTRAINSPEED
,TOMANUALMODE
,SETLIGHT
,STARTBELL
,STOPBELL
,SOUNDHORN
,SOUNDHORNPATTERN
,LOCOFUNCTION
,SETSENSORACTIVE
,SETSENSORINACTIVE
,HOLDSIGNAL
,RELEASESIGNAL
dataWhen
- a data element for whendataWhat1
- a data element for whatdataWhat2
- a data element for whatsWhen
- typically a readable description of when or the name of the triggering sensorssWhat
- typically a readable description of what or data such as TrainInfo File NamesWhat2
- typically a second string parameter for the action such as DCCAddress or roster entry.
-
-
Method Detail
-
setThreadObject
public void setThreadObject(java.lang.Object threadObj)
-
getThreadObject
public java.lang.Object getThreadObject()
-
getWhenCode
public int getWhenCode()
-
setWhenCode
public void setWhenCode(int n)
-
getWhatCode
public int getWhatCode()
-
setWhatCode
public void setWhatCode(int n)
-
getDataWhen
public int getDataWhen()
-
setDataWhen
public void setDataWhen(int n)
-
getDataWhat1Float
public float getDataWhat1Float()
-
setDataWhat1Float
public void setDataWhat1Float(float n)
-
getDataWhat1
public int getDataWhat1()
-
setDataWhat1
public void setDataWhat1(int n)
-
getDataWhat2
public int getDataWhat2()
-
setDataWhat2
public void setDataWhat2(int n)
-
getStringWhen
public java.lang.String getStringWhen()
-
setStringWhen
public void setStringWhen(java.lang.String s)
-
getStringWhat
public java.lang.String getStringWhat()
-
setStringWhat
public void setStringWhat(java.lang.String s)
-
getStringWhat2
public java.lang.String getStringWhat2()
-
setStringWhat2
public void setStringWhat2(java.lang.String s)
-
initialize
public void initialize()
Initialize all operational instance variables (not saved between runs).
-
getWaitingThread
public java.lang.Thread getWaitingThread()
-
setWaitingThread
public void setWaitingThread(java.lang.Thread t)
-
getWaitingForSectionExit
public boolean getWaitingForSectionExit()
-
setWaitingForSectionExit
public void setWaitingForSectionExit(boolean w)
-
getTargetTransitSection
public TransitSection getTargetTransitSection()
-
setTargetTransitSection
public void setTargetTransitSection(TransitSection ts)
-
getWaitingForBlock
public boolean getWaitingForBlock()
-
setWaitingForBlock
public void setWaitingForBlock(boolean w)
-
getWaitingForSensor
public boolean getWaitingForSensor()
-
setWaitingForSensor
public void setWaitingForSensor(boolean w)
-
getTriggerSensor
public Sensor getTriggerSensor()
-
setTriggerSensor
public void setTriggerSensor(Sensor s)
-
getSensorListener
public java.beans.PropertyChangeListener getSensorListener()
-
setSensorListener
public void setSensorListener(java.beans.PropertyChangeListener l)
-
disposeSensorListener
public void disposeSensorListener()
-
dispose
public void dispose()
-
-