Class AbstractSignalHead

    • Field Detail

      • mLit

        protected boolean mLit
        By default, signals are lit.
      • mHeld

        protected boolean mHeld
        By default, signals are not held.
    • Constructor Detail

      • AbstractSignalHead

        public AbstractSignalHead​(java.lang.String systemName,
                                  java.lang.String userName)
    • Method Detail

      • getAppearance

        public int getAppearance()
        Description copied from interface: SignalHead
        Get the Signal Head Appearance. Changes in this value can be listened to using the Appearance property.
        Specified by:
        getAppearance in interface SignalHead
        Returns:
        the appearance
      • isCleared

        public boolean isCleared()
        Determine whether this signal shows an aspect or appearance that allows travel past it, e.g. it's "been cleared". This might be a yellow or green appearance, or an Approach or Clear aspect
        Specified by:
        isCleared in interface Signal
        Returns:
        true if the signal is showing a clear indication; false otherwise
      • isShowingRestricting

        public boolean isShowingRestricting()
        Determine whether this signal shows an aspect or appearance that allows travel past it only at restricted speed. This might be a flashing red appearance, or a Restricting aspect.
        Specified by:
        isShowingRestricting in interface Signal
        Returns:
        true if the signal is showing a restricting indication; false otherwise
      • isAtStop

        public boolean isAtStop()
        Determine whether this signal shows an aspect or appearance that forbid travel past it. This might be a red appearance, or a Stop aspect. Stop-and-Proceed or Restricting would return false here.
        Specified by:
        isAtStop in interface Signal
        Returns:
        true if the signal is showing a stop indication; false otherwise
      • getLit

        public boolean getLit()
        Default behavior for "lit" parameter is to track value and return it.
        Specified by:
        getLit in interface Signal
        Specified by:
        getLit in interface SignalHead
        Returns:
        is lit
      • getHeld

        public boolean getHeld()
        "Held" parameter is just tracked and notified.
        Specified by:
        getHeld in interface Signal
        Specified by:
        getHeld in interface SignalHead
        Returns:
        is held
      • setState

        public void setState​(int s)
        Implement a shorter name for setAppearance.

        This generally shouldn't be used by Java code; use setAppearance instead. The is provided to make Jython script access easier to read.

        Specified by:
        setState in interface NamedBean
        Parameters:
        s - new state
      • getState

        public int getState()
        Implement a shorter name for getAppearance.

        This generally shouldn't be used by Java code; use getAppearance instead. The is provided to make Jython script access easier to read.

        Specified by:
        getState in interface NamedBean
        Returns:
        current state
      • getDefaultStateName

        public static java.lang.String getDefaultStateName​(int appearance)
        Get a localized text describing appearance from the corresponding state index.
        Parameters:
        appearance - the index of the appearance
        Returns:
        translated name for appearance
      • getValidStates

        public int[] getValidStates()
        Get an array of appearance indexes valid for the mast type.
        Specified by:
        getValidStates in interface SignalHead
        Returns:
        array of appearance state values available on this mast type
      • isTurnoutUsed

        abstract boolean isTurnoutUsed​(Turnout t)
        Check if a given turnout is used on this head.
        Parameters:
        t - Turnout object to check
        Returns:
        true if turnout is configured as output or driver of head
      • getBeanType

        @Nonnull
        public java.lang.String getBeanType()
        Description copied from interface: NamedBean
        For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.
        Specified by:
        getBeanType in interface NamedBean
        Returns:
        a string of the bean type, eg Turnout, Sensor etc