Interface SignalGroup
-
- All Superinterfaces:
java.lang.Comparable<NamedBean>
,NamedBean
,PropertyChangeProvider
- All Known Implementing Classes:
DefaultSignalGroup
public interface SignalGroup extends NamedBean
Signal Groups are used to represent European subsidary signals that would be sited with a signal mast. Such subsidary signals would be used to indicated routes, junctions and allowable speeds. Each such route/junction/speed would be represented by a single output signal (head), that is either Off or On. Within the group only one such signal head would be allowed on at any one time.The group is attached to a main signal mast, and can be configured to be activated depending upon one or more aspects when displayed on that signal mast.
Each signal head within the group is defined with an On and Off appearance, and a set of criteria in the form of matching turnouts and sensor states, that must be met for the head to be set On.
For code clarity, JMRI uses the terms (signal)Mast and (signal)Head instead of Signal. Masts show Aspects, Heads show Appearances, though outside the USA this will vary. Use localization to address this in the user interface.
- See Also:
DefaultSignalGroup
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description static int
ONACTIVE
static int
ONCLOSED
static int
ONINACTIVE
static int
ONTHROWN
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addSignalHead(NamedBeanHandle<SignalHead> headBean)
Add a Signal Head item for this Signal Head to the list in the Group.void
addSignalHead(SignalHead signalHead)
Add a Signal Head item for this Signal Head to the list in the Group.void
addSignalMastAspect(java.lang.String aspect)
Add an Aspect that can trigger the group activation.void
clearHeadSensor(SignalHead signalHead)
Delete all Sensors for a given Signal Head in the group.void
clearHeadTurnout(SignalHead signalHead)
Delete all Turnouts for a given Signal Head in the group.void
clearSignalMastAspect()
Clear the list of SignalMast Aspects that may trigger the group.void
deleteSignalHead(NamedBeanHandle<SignalHead> headBean)
Remove the Signal Head item for this Signal Head from the group by NamedBeanvoid
deleteSignalHead(SignalHead sh)
Remove the Signal Head item for this Signal Head from the group by Name.void
deleteSignalMastAspect(java.lang.String aspect)
Remove a SignalMast Aspect from the set of triggers.boolean
getEnabled()
Get enabled status of the signal group.SignalHead
getHeadItemBeanByIndex(int x)
Get a Signal Head by Index.java.lang.String
getHeadItemNameByIndex(int x)
Get the name of a Signal Head by Index.int
getHeadOffState(SignalHead signalHead)
Get the Off (conditions NOT met) State of a Signal Head item in the group.int
getHeadOffStateByIndex(int x)
Get the Off State for the Signal Head item at Index x in the group.int
getHeadOnState(SignalHead signalHead)
Get the On (conditions met) State of a Signal Head item in the group.int
getHeadOnStateByIndex(int x)
Get the On State for the Signal Head item at Index x in the group.int
getNumHeadItems()
Get the number of Signal Heads configured as items in this group.int
getNumHeadSensorsByIndex(int x)
Get the number of Sensors configured for the Signal Head at index x.int
getNumHeadTurnoutsByIndex(int x)
Get the number of turnouts configured for the Signal Head at index x.int
getNumSignalMastAspects()
Get the total number of Signal Mast Aspects available in this group.Sensor
getSensorByIndex(int x, int pSensor)
Get the Sensor at index pSensor, for the Signal Head at index x.java.lang.String
getSensorNameByIndex(int x, int pSensor)
Get the name of the Sensor at index pSensor for the Signal Head at index x.int
getSensorState(SignalHead signalHead, Sensor sensor)
Get the On state of the Sensor for the Signal Head in the group.int
getSensorStateByIndex(int x, int pSensor)
Get the On state of the Sensor at index pSensor for the Signal Head at index x.boolean
getSensorTurnoutOper(SignalHead signalHead)
Get the AND/OR conditional operand set for a Signal Head in the group.boolean
getSensorTurnoutOperByIndex(int x)
Get the state of the AND/OR conditional operand for Signal Head at Index.SignalMast
getSignalMast()
Get the main Signal Mast in a group.java.lang.String
getSignalMastAspectByIndex(int x)
Get a SignalMast Aspect for the Main Signal Mast by its Index.java.lang.String
getSignalMastName()
Get the name of the main Signal Mast in a group.int
getState()
Provide generic access to internal state.Turnout
getTurnoutByIndex(int x, int pTurnout)
Get the Turnout at index x, for the Signal Head at index x in the group.java.lang.String
getTurnoutNameByIndex(int x, int pTurnout)
Get the Name of the Turnout at index pTurnout, for the Signal Head at index x in the group.int
getTurnoutState(SignalHead signalHead, Turnout turnout)
Get the On state of the Turnout for the given Signal Head in the group.int
getTurnoutStateByIndex(int x, int pTurnout)
Get the On state of the Turnout at index pTurnout, for the Signal Head at index x in the group.int
getTurnoutStateByIndex(int x, Turnout turnout)
Get the On state of a given Turnout for the Signal Head at index x.boolean
isHeadIncluded(SignalHead signalHead)
Inquire if a Signal Head item for this head is included in this Group.boolean
isSensorIncluded(SignalHead signalHead, Sensor sensor)
Inquire if a Sensor is included in the Signal Head Calculation.boolean
isSignalMastAspectIncluded(java.lang.String aspect)
Inquire if a Signal Mast Aspect is included in the group.boolean
isTurnoutIncluded(SignalHead signalHead, Turnout turnout)
Inquire if a Turnout is included in the Signal Head Calculation.void
setEnabled(boolean boo)
Set enabled status of the signal group.void
setHeadAlignSensor(SignalHead signalHead, Sensor sensor, int state)
Add a Sensor and its On state to a Signal Head.void
setHeadAlignTurnout(SignalHead signalHead, Turnout turnout, int state)
Add a Turnout and its On state to a Signal Head.void
setHeadOffState(SignalHead signalHead, int state)
Set the Off (conditions NOT met) State of a Signal Head item in the Group.void
setHeadOnState(SignalHead signalHead, int state)
Set the On (conditions met) State of a Signal Head item in the Group.void
setSensorTurnoutOper(SignalHead signalHead, boolean boo)
Set whether the sensors and turnouts should be treated as separate calculations (OR) or as one (AND) when determining if the Signal Head should be On or Off.void
setSignalMast(java.lang.String mastName)
Set the main Signal Mast for the Group by name.void
setSignalMast(SignalMast signalMast, java.lang.String mastName)
Set the main Signal Mast for the Group.void
setState(int state)
Provide generic access to internal state.-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
ONACTIVE
static final int ONACTIVE
- See Also:
- Constant Field Values
-
ONINACTIVE
static final int ONINACTIVE
- See Also:
- Constant Field Values
-
ONCLOSED
static final int ONCLOSED
- See Also:
- Constant Field Values
-
ONTHROWN
static final int ONTHROWN
- See Also:
- Constant Field Values
-
-
Method Detail
-
setEnabled
void setEnabled(boolean boo)
Set enabled status of the signal group.- Parameters:
boo
- true if signal group should be enabled; false otherwise
-
getEnabled
boolean getEnabled()
Get enabled status of the signal group.- Returns:
- true if signal group is enabled; false otherwise
-
setSignalMast
void setSignalMast(java.lang.String mastName)
Set the main Signal Mast for the Group by name.- Parameters:
mastName
- Name of the (existing) Signal Mast to set as main mast for the group
-
setSignalMast
void setSignalMast(SignalMast signalMast, java.lang.String mastName)
Set the main Signal Mast for the Group.- Parameters:
signalMast
- Mast object to attachmastName
- Name of the (existing) Signal Mast to set as main mast for the group
-
getSignalMastName
java.lang.String getSignalMastName()
Get the name of the main Signal Mast in a group.- Returns:
- Name of the mast as string
-
getSignalMast
SignalMast getSignalMast()
Get the main Signal Mast in a group.- Returns:
- The main Signal Mast as bean
-
clearSignalMastAspect
void clearSignalMastAspect()
Clear the list of SignalMast Aspects that may trigger the group. Causes the Aspect list to be rebuilt next time it is called
-
addSignalMastAspect
void addSignalMastAspect(java.lang.String aspect)
Add an Aspect that can trigger the group activation.- Parameters:
aspect
- Name of an aspect for the Main Signal Mast in the Group, must be valid for the Mast type
-
getNumSignalMastAspects
int getNumSignalMastAspects()
Get the total number of Signal Mast Aspects available in this group.- Returns:
- the number of Aspects on the main Signal Mast, null if no Main Mast is assigned
-
getSignalMastAspectByIndex
@CheckForNull java.lang.String getSignalMastAspectByIndex(int x)
Get a SignalMast Aspect for the Main Signal Mast by its Index.- Parameters:
x
- index of the Signal Mast Aspect in the list- Returns:
- the aspect or null if there are no aspects with that index
-
isSignalMastAspectIncluded
boolean isSignalMastAspectIncluded(java.lang.String aspect)
Inquire if a Signal Mast Aspect is included in the group.- Parameters:
aspect
- name of the Aspect, i.e. "Clear"- Returns:
- true if aspect is included in group
-
deleteSignalMastAspect
void deleteSignalMastAspect(java.lang.String aspect)
Remove a SignalMast Aspect from the set of triggers.- Parameters:
aspect
- Name of the Aspect, i.e. "Clear"
-
addSignalHead
void addSignalHead(NamedBeanHandle<SignalHead> headBean)
Add a Signal Head item for this Signal Head to the list in the Group.- Parameters:
headBean
- The Signal Head as a Named Bean
-
addSignalHead
void addSignalHead(SignalHead signalHead)
Add a Signal Head item for this Signal Head to the list in the Group.- Parameters:
signalHead
- The Signal Head object
-
getHeadItemBeanByIndex
SignalHead getHeadItemBeanByIndex(int x)
Get a Signal Head by Index.- Parameters:
x
- Index of the SignalHead in the Group- Returns:
- null if there are no Signal Heads with that index in the group
-
getHeadItemNameByIndex
@CheckForNull java.lang.String getHeadItemNameByIndex(int x)
Get the name of a Signal Head by Index.- Parameters:
x
- Index of the SignalHead in the Group- Returns:
- null if there are no Signal Heads with that index in the group
-
getHeadOnStateByIndex
int getHeadOnStateByIndex(int x)
Get the On State for the Signal Head item at Index x in the group.- Parameters:
x
- Index of the SignalHead in Group- Returns:
- -1 if there are less than 'x' Signal Heads defined
-
getHeadOffStateByIndex
int getHeadOffStateByIndex(int x)
Get the Off State for the Signal Head item at Index x in the group.- Parameters:
x
- Index of the SignalHead in Group- Returns:
- -1 if there are less than 'x' Signal Heads defined
-
deleteSignalHead
void deleteSignalHead(SignalHead sh)
Remove the Signal Head item for this Signal Head from the group by Name.- Parameters:
sh
- The Signal Head to be deleted from the group.
-
deleteSignalHead
void deleteSignalHead(NamedBeanHandle<SignalHead> headBean)
Remove the Signal Head item for this Signal Head from the group by NamedBean- Parameters:
headBean
- The Named Bean to be removed from the group.
-
getNumHeadItems
int getNumHeadItems()
Get the number of Signal Heads configured as items in this group.- Returns:
- the number of Signal Heads
-
isHeadIncluded
boolean isHeadIncluded(SignalHead signalHead)
Inquire if a Signal Head item for this head is included in this Group.- Parameters:
signalHead
- The Signal Head object we are querying- Returns:
- true if the signal head is included in the group; false otherwise
-
getHeadOnState
int getHeadOnState(SignalHead signalHead)
Get the On (conditions met) State of a Signal Head item in the group.- Parameters:
signalHead
- The Signal Head object we are querying- Returns:
- state value for the On state (appearance)
-
getHeadOffState
int getHeadOffState(SignalHead signalHead)
Get the Off (conditions NOT met) State of a Signal Head item in the group.- Parameters:
signalHead
- The Signal Head Bean object we are querying- Returns:
- state value for the Off state (appearance)
-
setHeadOnState
void setHeadOnState(SignalHead signalHead, int state)
Set the On (conditions met) State of a Signal Head item in the Group.- Parameters:
signalHead
- The SignalHead Beanstate
- The Appearance that the SignalHead will change to when the conditions are met.
-
setHeadOffState
void setHeadOffState(SignalHead signalHead, int state)
Set the Off (conditions NOT met) State of a Signal Head item in the Group.- Parameters:
signalHead
- The SignalHead Beanstate
- The Apperance that the SignalHead will change to when the conditions are NOT met.
-
setSensorTurnoutOper
void setSensorTurnoutOper(SignalHead signalHead, boolean boo)
Set whether the sensors and turnouts should be treated as separate calculations (OR) or as one (AND) when determining if the Signal Head should be On or Off.- Parameters:
signalHead
- The SignalHead Beanboo
- Provide true for AND, false for OR
-
getSensorTurnoutOperByIndex
boolean getSensorTurnoutOperByIndex(int x)
Get the state of the AND/OR conditional operand for Signal Head at Index.- Parameters:
x
- Index of the SignalHead in Group- Returns:
- true when set to AND, false for OR
-
getNumHeadTurnoutsByIndex
int getNumHeadTurnoutsByIndex(int x)
Get the number of turnouts configured for the Signal Head at index x.- Parameters:
x
- Index of the SignalHead in Group- Returns:
- -1 if there are less than 'x' Signal Heads defined
-
setHeadAlignTurnout
void setHeadAlignTurnout(SignalHead signalHead, Turnout turnout, int state)
Add a Turnout and its On state to a Signal Head.- Parameters:
signalHead
- SignalHead we are adding the turnout toturnout
- Turnout Beanstate
- Value for the turnout On state (Turnout.THROWN or Turnout.CLOSED).
-
isTurnoutIncluded
boolean isTurnoutIncluded(SignalHead signalHead, Turnout turnout)
Inquire if a Turnout is included in the Signal Head Calculation.- Parameters:
signalHead
- signalHead that may consider turnoutturnout
- turnout to consider- Returns:
- true if turnout state is considered; false otherwise
-
getTurnoutState
int getTurnoutState(SignalHead signalHead, Turnout turnout)
Get the On state of the Turnout for the given Signal Head in the group.- Parameters:
signalHead
- Signal Head Beanturnout
- The Turnout within the Group- Returns:
- -1 if the Turnout or Signal Head is invalid
-
getTurnoutStateByIndex
int getTurnoutStateByIndex(int x, Turnout turnout)
Get the On state of a given Turnout for the Signal Head at index x.- Parameters:
x
- Index for the Signal Head in the groupturnout
- Name of the Turnout configured for the head- Returns:
- -1 if the Turnout or Signal Head is invalid
-
getTurnoutStateByIndex
int getTurnoutStateByIndex(int x, int pTurnout)
Get the On state of the Turnout at index pTurnout, for the Signal Head at index x in the group.- Parameters:
x
- Index for the Signal Head in the grouppTurnout
- Index of the Turnout configured for the head- Returns:
- -1 if the Turnout or Signal Head is invalid
-
getTurnoutNameByIndex
@CheckForNull java.lang.String getTurnoutNameByIndex(int x, int pTurnout)
Get the Name of the Turnout at index pTurnout, for the Signal Head at index x in the group.- Parameters:
x
- Index for the Signal Head in the grouppTurnout
- Index for the turnout in the signal head item- Returns:
- null if the Turnout or Signal Head is invalid
-
getTurnoutByIndex
@CheckForNull Turnout getTurnoutByIndex(int x, int pTurnout)
Get the Turnout at index x, for the Signal Head at index x in the group.- Parameters:
x
- Index for the Signal Head in the grouppTurnout
- Index for the turnout in the signal head item- Returns:
- null if the Turnout or Signal Head is invalid
-
setHeadAlignSensor
void setHeadAlignSensor(SignalHead signalHead, Sensor sensor, int state)
Add a Sensor and its On state to a Signal Head.- Parameters:
signalHead
- Signal Head we are adding the sensor tosensor
- Sensor Beanstate
- Value for the Sensor On state (Sensor.ACTIVE or Sensor.INACTIVE).
-
isSensorIncluded
boolean isSensorIncluded(SignalHead signalHead, Sensor sensor)
Inquire if a Sensor is included in the Signal Head Calculation.- Parameters:
signalHead
- Signal Head Beansensor
- Sensor Bean- Returns:
- true if sensor is considered for signalHead state; false otherwise
-
getSensorState
int getSensorState(SignalHead signalHead, Sensor sensor)
Get the On state of the Sensor for the Signal Head in the group.- Parameters:
signalHead
- The Signal Head Beansensor
- Name of the Sensor in the head item- Returns:
- -1 if the Sensor or Signal Head is invalid
-
getSensorStateByIndex
int getSensorStateByIndex(int x, int pSensor)
Get the On state of the Sensor at index pSensor for the Signal Head at index x.- Parameters:
x
- Index for the Signal Head in the grouppSensor
- Index of the Sensor in the head item- Returns:
- -1 if the Sensor or Signal Head is invalid
-
getSensorNameByIndex
@CheckForNull java.lang.String getSensorNameByIndex(int x, int pSensor)
Get the name of the Sensor at index pSensor for the Signal Head at index x.- Parameters:
x
- Index for the Signal Head in the grouppSensor
- Index of the Sensor in the head item- Returns:
- null if the Sensor or Signal Head is invalid
-
getSensorByIndex
@CheckForNull Sensor getSensorByIndex(int x, int pSensor)
Get the Sensor at index pSensor, for the Signal Head at index x.- Parameters:
x
- Index for the Signal Head in the grouppSensor
- Index of the Sensor in the head item- Returns:
- null if the Sensor or Signal Head is invalid
-
getSensorTurnoutOper
boolean getSensorTurnoutOper(SignalHead signalHead)
Get the AND/OR conditional operand set for a Signal Head in the group.- Parameters:
signalHead
- The Signal Head Bean- Returns:
- true when set to AND, false for OR
-
getNumHeadSensorsByIndex
int getNumHeadSensorsByIndex(int x)
Get the number of Sensors configured for the Signal Head at index x.- Parameters:
x
- Index for the Signal Head in the group- Returns:
- -1 if there are less than 'x' Signal Heads defined
-
clearHeadTurnout
void clearHeadTurnout(SignalHead signalHead)
Delete all Turnouts for a given Signal Head in the group.- Parameters:
signalHead
- The Signal Head Bean from which the Turnouts will be removed
-
clearHeadSensor
void clearHeadSensor(SignalHead signalHead)
Delete all Sensors for a given Signal Head in the group.- Parameters:
signalHead
- The Signal Head Bean from which the Turnouts will be removed
-
getState
int getState()
Description copied from interface:NamedBean
Provide generic access to internal state.This generally shouldn't be used by Java code; use the class-specific form instead (e.g. getCommandedState in Turnout). This is provided to make scripts easier to read.
-
-