Package jmri.jmrit.z21server
Class TurnoutNumberMapHandler
java.lang.Object
jmri.jmrit.z21server.TurnoutNumberMapHandler
- All Implemented Interfaces:
PropertyChangeListener,EventListener
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()on destruction of the instance - would probably never occur...static TurnoutNumberMapHandlerstatic Class<?>[]intgetStateForNumber(int turnoutNumber) Get the state of a component given by the Z21 Turnout Number.voidLoad our local hash map, so we have a cachevoidProperty change listener.voidsetStateForNumber(int turnoutNumber, int state) Set the state of a component identified by the mapped number from a turnout state (THROWN or CLOSED)
-
Field Details
-
beanProperty
- See Also:
-
-
Method Details
-
getInstance
-
getManagerClassList
-
getStateForNumber
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
Set the state of a component identified by the mapped number from a turnout state (THROWN or CLOSED)- Parameters:
turnoutNumber- - the Z21 Turnout Numberstate- - a turnout state
-
loadNumberList
Load our local hash map, so we have a cache -
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:
propertyChangein interfacePropertyChangeListener- Parameters:
e- is the propery change event
-