Interface SignalGroup
- All Superinterfaces:
Comparable<NamedBean>,NamedBean,PropertyChangeProvider
- All Known Implementing Classes:
DefaultSignalGroup
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSignalHead(NamedBeanHandle<SignalHead> headBean) Add a Signal Head item for this Signal Head to the list in the Group.voidaddSignalHead(SignalHead signalHead) Add a Signal Head item for this Signal Head to the list in the Group.voidaddSignalMastAspect(String aspect) Add an Aspect that can trigger the group activation.voidclearHeadSensor(SignalHead signalHead) Delete all Sensors for a given Signal Head in the group.voidclearHeadTurnout(SignalHead signalHead) Delete all Turnouts for a given Signal Head in the group.voidClear the list of SignalMast Aspects that may trigger the group.voiddeleteSignalHead(NamedBeanHandle<SignalHead> headBean) Remove the Signal Head item for this Signal Head from the group by NamedBeanvoidRemove the Signal Head item for this Signal Head from the group by Name.voiddeleteSignalMastAspect(String aspect) Remove a SignalMast Aspect from the set of triggers.booleanGet enabled status of the signal group.getHeadItemBeanByIndex(int x) Get a Signal Head by Index.getHeadItemNameByIndex(int x) Get the name of a Signal Head by Index.intgetHeadOffState(SignalHead signalHead) Get the Off (conditions NOT met) State of a Signal Head item in the group.intgetHeadOffStateByIndex(int x) Get the Off State for the Signal Head item at Index x in the group.intgetHeadOnState(SignalHead signalHead) Get the On (conditions met) State of a Signal Head item in the group.intgetHeadOnStateByIndex(int x) Get the On State for the Signal Head item at Index x in the group.intGet the number of Signal Heads configured as items in this group.intgetNumHeadSensorsByIndex(int x) Get the number of Sensors configured for the Signal Head at index x.intgetNumHeadTurnoutsByIndex(int x) Get the number of turnouts configured for the Signal Head at index x.intGet the total number of Signal Mast Aspects available in this group.getSensorByIndex(int x, int pSensor) Get the Sensor at index pSensor, for the Signal Head at index x.getSensorNameByIndex(int x, int pSensor) Get the name of the Sensor at index pSensor for the Signal Head at index x.intgetSensorState(SignalHead signalHead, Sensor sensor) Get the On state of the Sensor for the Signal Head in the group.intgetSensorStateByIndex(int x, int pSensor) Get the On state of the Sensor at index pSensor for the Signal Head at index x.booleangetSensorTurnoutOper(SignalHead signalHead) Get the AND/OR conditional operand set for a Signal Head in the group.booleangetSensorTurnoutOperByIndex(int x) Get the state of the AND/OR conditional operand for Signal Head at Index.Get the main Signal Mast in a group.getSignalMastAspectByIndex(int x) Get a SignalMast Aspect for the Main Signal Mast by its Index.Get the name of the main Signal Mast in a group.intgetState()Provide generic access to internal state.getTurnoutByIndex(int x, int pTurnout) Get the Turnout at index x, for the Signal Head at index x in the group.getTurnoutNameByIndex(int x, int pTurnout) Get the Name of the Turnout at index pTurnout, for the Signal Head at index x in the group.intgetTurnoutState(SignalHead signalHead, Turnout turnout) Get the On state of the Turnout for the given Signal Head in the group.intgetTurnoutStateByIndex(int x, int pTurnout) Get the On state of the Turnout at index pTurnout, for the Signal Head at index x in the group.intgetTurnoutStateByIndex(int x, Turnout turnout) Get the On state of a given Turnout for the Signal Head at index x.booleanisHeadIncluded(SignalHead signalHead) Inquire if a Signal Head item for this head is included in this Group.booleanisSensorIncluded(SignalHead signalHead, Sensor sensor) Inquire if a Sensor is included in the Signal Head Calculation.booleanisSignalMastAspectIncluded(String aspect) Inquire if a Signal Mast Aspect is included in the group.booleanisTurnoutIncluded(SignalHead signalHead, Turnout turnout) Inquire if a Turnout is included in the Signal Head Calculation.voidsetEnabled(boolean boo) Set enabled status of the signal group.voidsetHeadAlignSensor(SignalHead signalHead, Sensor sensor, int state) Add a Sensor and its On state to a Signal Head.voidsetHeadAlignTurnout(SignalHead signalHead, Turnout turnout, int state) Add a Turnout and its On state to a Signal Head.voidsetHeadOffState(SignalHead signalHead, int state) Set the Off (conditions NOT met) State of a Signal Head item in the Group.voidsetHeadOnState(SignalHead signalHead, int state) Set the On (conditions met) State of a Signal Head item in the Group.voidsetSensorTurnoutOper(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.voidsetSignalMast(String mastName) Set the main Signal Mast for the Group by name.voidsetSignalMast(SignalMast signalMast, String mastName) Set the main Signal Mast for the Group.voidsetState(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, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
ONACTIVE
- See Also:
-
ONINACTIVE
- See Also:
-
ONCLOSED
- See Also:
-
ONTHROWN
- See Also:
-
-
Method Details
-
setEnabled
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
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
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
Get the name of the main Signal Mast in a group.- Returns:
- Name of the mast as string
-
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
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
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
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
Remove a SignalMast Aspect from the set of triggers.- Parameters:
aspect- Name of the Aspect, i.e. "Clear"
-
addSignalHead
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
Add a Signal Head item for this Signal Head to the list in the Group.- Parameters:
signalHead- The Signal Head object
-
getHeadItemBeanByIndex
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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:NamedBeanProvide 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.
-
setState
Description copied from interface:NamedBeanProvide generic access to internal state.This generally shouldn't be used by Java code; use the class-specific form instead (e.g. setCommandedState in Turnout). This is provided to make scripts access easier to read.
-