Class DefaultSignalHead

All Implemented Interfaces:
VetoableChangeListener, Comparable<NamedBean>, EventListener, PropertyChangeProvider, NamedBean, Signal, SignalHead
Direct Known Subclasses:
AcelaSignalHead, DoubleTurnoutSignalHead, LsDecSignalHead, MergSD2SignalHead, SE8cSignalHead, SE8cSignalHead, SerialSignalHead, SingleTurnoutSignalHead, VirtualSignalHead

public abstract class DefaultSignalHead extends AbstractSignalHead
Default implementation of the basic logic of the SignalHead interface. This class only claims support for the Red, Yellow and Green appearances, and their corresponding flashing forms. Support for Lunar is deferred to DefaultLunarSignalHead or an extended class.
  • Field Details

    • mFlashOn

      protected boolean mFlashOn
      Should a flashing signal be on (lit) now?
    • timer

    • delay

      public int delay
      On or off time of flashing signal. Public so that it can be overridden by scripting (before first use)
    • masterDelay

      public static int masterDelay
  • Constructor Details

  • Method Details

    • setAppearance

      public void setAppearance(int newAppearance)
      Description copied from interface: SignalHead
      Set the Signal Head Appearance.
      Parameters:
      newAppearance - integer representing a valid Appearance for this head
    • appearanceSetsFlashTimer

      protected void appearanceSetsFlashTimer(int newAppearance)
      Call to set timer when updating the appearance.
      Parameters:
      newAppearance - the new appearance
    • setLit

      public void setLit(boolean newLit)
      Description copied from interface: SignalHead
    • setHeld

      public void setHeld(boolean newHeld)
      Set the held parameter.

      Note that this does not directly effect the output on the layout; the held parameter is a local variable which effects the aspect only via higher-level logic.

      Parameters:
      newHeld - new Held state, true if Held, to be compared with current Held state
    • updateOutput

      protected abstract void updateOutput()
      Type-specific routine to handle output to the layout hardware.

      Does not notify listeners of changes; that's done elsewhere. Should use the following variables to determine what to send:

      • mAppearance
      • mLit
      • mFlashOn
    • startFlash

      protected void startFlash()
      Start the timer that controls flashing.
    • stopFlash

      protected void stopFlash()
    • getValidStates

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

      Get an array of non-localized appearance keys valid for the mast type. For GUI application consider using (capitalized) SignalHead.getValidStateNames()
      Specified by:
      getValidStateKeys in interface SignalHead
      Overrides:
      getValidStateKeys in class AbstractSignalHead
      Returns:
      array of translated appearance names available on this mast type
    • getValidStateNames

      Get an array of localized appearance descriptions valid for the mast type. For persistance and comparison consider using SignalHead.getValidStateKeys()
      Specified by:
      getValidStateNames in interface SignalHead
      Overrides:
      getValidStateNames in class AbstractSignalHead
      Returns:
      array of translated appearance names
    • isTurnoutUsed

      public boolean isTurnoutUsed(Turnout t)
      Description copied from class: AbstractSignalHead
      Check if a given turnout is used on this head.
      Specified by:
      isTurnoutUsed in class AbstractSignalHead
      Parameters:
      t - Turnout object to check
      Returns:
      true if turnout is configured as output or driver of head
    • getUsageReport

      Description copied from interface: NamedBean
      Get a list of references for the specified bean.
      Parameters:
      bean - The bean to be checked.
      Returns:
      a list of NamedBeanUsageReports or an empty ArrayList.