Package jmri

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
    • 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 attach
        mastName - 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 Bean
        state - 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 Bean
        state - 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 Bean
        boo - 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 to
        turnout - Turnout Bean
        state - 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 turnout
        turnout - 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 Bean
        turnout - 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 group
        turnout - 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 group
        pTurnout - 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 group
        pTurnout - 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 group
        pTurnout - 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 to
        sensor - Sensor Bean
        state - 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 Bean
        sensor - 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 Bean
        sensor - 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 group
        pSensor - 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 group
        pSensor - 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 group
        pSensor - 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.

        Specified by:
        getState in interface NamedBean
        Returns:
        the state
      • setState

        void setState​(int state)
        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. setCommandedState in Turnout). This is provided to make scripts access easier to read.

        Specified by:
        setState in interface NamedBean
        Parameters:
        state - the state