Package jmri

Interface Signal

All Superinterfaces:
Comparable<NamedBean>, NamedBean, PropertyChangeProvider
All Known Subinterfaces:
SignalHead
All Known Implementing Classes:
AbstractSignalHead, AcelaSignalHead, DccSignalHead, DefaultSignalHead, DoubleTurnoutSignalHead, LsDecSignalHead, MergSD2SignalHead, QuadOutputSignalHead, SE8cSignalHead, SE8cSignalHead, SerialSignalHead, SingleTurnoutSignalHead, TripleOutputSignalHead, TripleTurnoutSignalHead, VirtualSignalHead

public interface Signal
extends NamedBean
Represent a single signal, either in SignalHead or SignalMast form.

This interface defines two bound parameters:

Lit
Whether the signal's lamps are lit or left dark.

This differs from the DARK color or all-off appearance. Lit is intended to allow you to extinguish a signal for approach lighting, while still allowing it to be set to a definite appearance or aspect for e.g. display on a panel or evaluation in higher level logic.

Held
Whether the signal's lamps should be forced to a specific appearance or aspect, e.g. RED or STOP, in higher-level logic.

For use in signaling systems, this is a convenient way of storing whether a higher-level of control (e.g. non-vital system or dispatcher) has "held" the signal at stop. It does not effect how this signal actually works; any appearance can be set and will be displayed even when "held" is set.

The following can be relied on:

  • isCleared() && isAtStop() is false: they are disjoint.
  • isAtStop() && isShowingRestricting() is false: they are disjoint.
  • isShowingRestricting() && isCleared() is false: they are disjoint.
  • isAtStop() || isShowingRestricting() || isCleared() is usually true, but it can be false; the three methods do not cover all cases

This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

  • Method Details

    • isCleared

      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.
      Returns:
      true if the signal is showing a clear indication; false otherwise
    • 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.
      Returns:
      true if the signal is showing a restricting indication; false otherwise
    • isAtStop

      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.
      Returns:
      true if the signal is showing a stop indication; false otherwise
    • getLit

      boolean getLit()
      Get whether the signal is lit or dark. Changes to this value can be listened to using the Lit property.
      Returns:
      true if lit; false if dark
    • setLit

      void setLit​(boolean newLit)
    • getHeld

      boolean getHeld()
      Get whether the signal is held. Changes to this value can be listened to using the Held property. It controls what mechanisms can control the signal's appearance. The actual semantics are defined by those external mechanisms.
      Returns:
      true if held; false otherwise
    • setHeld

      void setHeld​(boolean newHeld)