Class SimpleTurnout

java.lang.Object
jmri.jmrix.loconet.ds64.SimpleTurnout
Direct Known Subclasses:
SimpleTurnoutStateEntry

public class SimpleTurnout
extends Object
Provides a simple object to track a turnout number and the position of that turnout.

Turnout numbering is the same as seen on a Digitrax throttle display; Tools using values from objects of this type must provide the appropriate transform to create turnout numbering which is suitable for use within LocoNet messaging.

  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleTurnout()
    Constructor used if address is unknown.
    SimpleTurnout​(Integer addr, boolean closed)
    Constructor used when the turnout address and position are known.
    SimpleTurnout​(Integer addr, boolean closed, boolean unused)
    Constructor used when the turnout address, position, and validity state are known by the instantiating method.
  • Method Summary

    Modifier and Type Method Description
    Integer getAddress()
    Returns the address field of the simpleTurnout object.
    boolean getIsClosed()
    Returns position of the turnout as represented in an object field.
    boolean getIsUnused()
    Returns the "used" state of the object, as represented in an object field.
    boolean isValid()
    Get the "validity" state of the simpleTurnout object.
    void setAddress​(Integer addr)
    Sets the turnout address of the simpleTurnout object.
    void setIsClosed​(boolean isclosed)
    Sets an object field to show the current position of a simpleTurnout object.
    void setIsUnused()
    Define the turnout as "unused" within a field in the object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleTurnout

      Constructor used if address is unknown. The constructor creates an object which is marked as "unused".
    • SimpleTurnout

      public SimpleTurnout​(Integer addr, boolean closed)
      Constructor used when the turnout address and position are known.

      Validity state is assumed to be "valid".

      Parameters:
      addr - turnout address
      closed - true if turnout is closed, else false
    • SimpleTurnout

      public SimpleTurnout​(Integer addr, boolean closed, boolean unused)
      Constructor used when the turnout address, position, and validity state are known by the instantiating method.
      Parameters:
      addr - turnout address
      closed - true if turnout is closed, else false
      unused - trud if turnout is unused, else false
  • Method Details

    • isValid

      public boolean isValid()
      Get the "validity" state of the simpleTurnout object. This "validity" state does not necessarily reflect the "validity" state of a physical turnout.
      Returns:
      true if the address is valid
    • setAddress

      public void setAddress​(Integer addr)
      Sets the turnout address of the simpleTurnout object.
      Parameters:
      addr - address value
    • getAddress

      public Integer getAddress()
      Returns the address field of the simpleTurnout object.
      Returns:
      the address from the GUI element
    • setIsClosed

      public void setIsClosed​(boolean isclosed)
      Sets an object field to show the current position of a simpleTurnout object. This position does not necessarily reflect the actual position of an associated physical turnout.
      Parameters:
      isclosed - true if the object is to be marked as closed.
    • getIsClosed

      public boolean getIsClosed()
      Returns position of the turnout as represented in an object field. This position does not necessarily reflect the actual position of an associated physical turnout.
      Returns:
      true if turnout position is closed, else false
    • getIsUnused

      public boolean getIsUnused()
      Returns the "used" state of the object, as represented in an object field. This does not necessarily reflect the actual "used" state of the physical device.
      Returns:
      true if turnout is "unused", else false
    • setIsUnused

      public void setIsUnused()
      Define the turnout as "unused" within a field in the object.