Class TurnoutNumberMapHandler

java.lang.Object
jmri.jmrit.z21server.TurnoutNumberMapHandler
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class TurnoutNumberMapHandler extends Object implements PropertyChangeListener
Handle the mapping from a Z21 turnout number to a JMRI Named Bean. This is not restricted to just JMRI turnouts, the mapping works for: - Turnouts - Lights (thrown = ON, closed = OFF - Routes (thrown sets the route, closed does nothing) - Signal Masts and Signal Heads (closed = HELD, thrown = not HELD, the aspect/appearance itself can not be modified) - Sensors (thrown = ACTIVE, closed = INACTIVE). Used to triggers all actions bound to the sensor If a component should be used by a Z21 turnout number, the number will be stored in a property of the bean.
  • Field Details

  • Method Details

    • getInstance

    • getManagerClassList

      public static Class<?>[] getManagerClassList()
    • getStateForNumber

      public int getStateForNumber(int turnoutNumber)
      Get the state of a component given by the Z21 Turnout Number. Get the the component from the hash map. The state is either THROWN, CLOSED or UNKNOWN. For other components than turnouts, their state will be converted into a turnout state.
      Parameters:
      turnoutNumber - - the Z21 Turnout Number
      Returns:
      the current state converted to a turnout state
    • setStateForNumber

      public void setStateForNumber(int turnoutNumber, int state)
      Set the state of a component identified by the mapped number from a turnout state (THROWN or CLOSED)
      Parameters:
      turnoutNumber - - the Z21 Turnout Number
      state - - a turnout state
    • loadNumberList

      public void loadNumberList()
      Load our local hash map, so we have a cache
    • dispose

      public void dispose()
      on destruction of the instance - would probably never occur...
    • propertyChange

      Property change listener. (Re-)loads the cache from all mapped components. Also called from the UI if the mapping has been changed by the user.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - is the propery change event