Package jmri.jmrix.openlcb
Class OlcbSignalMast.StateMachine<T>
- java.lang.Object
-
- org.openlcb.AbstractConnection
-
- org.openlcb.MessageDecoder
-
- jmri.jmrix.openlcb.OlcbSignalMast.StateMachine<T>
-
- All Implemented Interfaces:
Connection
- Enclosing class:
- OlcbSignalMast
class OlcbSignalMast.StateMachine<T> extends MessageDecoder
Implement a general state machine where state transitions are associated with the production and consumption of specific events. There's a one-to-one mapping between transitions and events. EventID storage is via Strings, so that the user-visible eventID string is preserved.non-static because it references systemMemo from parent class
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openlcb.Connection
Connection.ConnectionListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Connectionconnectionprotected java.util.HashMap<EventID,T>eventToState(package private) booleaninitizalized(package private) NodeIDnode(package private) Tstateprotected java.util.HashMap<T,EventID>stateToEventIDprotected java.util.HashMap<T,java.lang.String>stateToEventString
-
Constructor Summary
Constructors Constructor Description StateMachine(Connection connection, NodeID node, T start)
-
Method Summary
-
Methods inherited from class org.openlcb.MessageDecoder
defaultHandler, handleConsumerRangeIdentified, handleDatagram, handleDatagramAcknowledged, handleDatagramRejected, handleInitializationComplete, handleLearnEvent, handleOptionalIntRejected, handleProducerRangeIdentified, handleProtocolIdentificationReply, handleProtocolIdentificationRequest, handleSimpleNodeIdentInfoReply, handleSimpleNodeIdentInfoRequest, handleStreamDataComplete, handleStreamDataProceed, handleStreamDataSend, handleStreamInitiateReply, handleStreamInitiateRequest, handleTractionControlReply, handleTractionControlRequest, handleTractionProxyReply, handleTractionProxyRequest, handleUnknownMTI, handleVerifiedNodeIDNumber, handleVerifyNodeIDNumberAddressed, handleVerifyNodeIDNumberGlobal, put
-
Methods inherited from class org.openlcb.AbstractConnection
registerStartNotification
-
-
-
-
Field Detail
-
connection
final Connection connection
-
initizalized
boolean initizalized
-
stateToEventString
protected final java.util.HashMap<T,java.lang.String> stateToEventString
-
stateToEventID
protected final java.util.HashMap<T,EventID> stateToEventID
-
eventToState
protected final java.util.HashMap<EventID,T> eventToState
-
-
Constructor Detail
-
StateMachine
public StateMachine(@Nonnull Connection connection, @Nonnull NodeID node, @Nonnull T start)
-
-
Method Detail
-
setEventForState
public void setEventForState(@Nonnull T key, @Nonnull java.lang.String value)
-
getEventIDForState
@CheckForNull public EventID getEventIDForState(@Nonnull T key)
-
getEventStringForState
@CheckForNull public java.lang.String getEventStringForState(@Nonnull T key)
-
getEventIDState
EventState getEventIDState(EventID event)
Internal method to determine the EventState for a reply to an Identify* method- Parameters:
event- Method returns the underlying state for this EventID- Returns:
- State corresponding to the given EventID
-
handleProducerConsumerEventReport
public void handleProducerConsumerEventReport(@Nonnull ProducerConsumerEventReportMessage msg, Connection sender)
- Overrides:
handleProducerConsumerEventReportin classMessageDecoder
-
handleProducerIdentified
public void handleProducerIdentified(@Nonnull ProducerIdentifiedMessage msg, Connection sender)
- Overrides:
handleProducerIdentifiedin classMessageDecoder
-
handleConsumerIdentified
public void handleConsumerIdentified(@Nonnull ConsumerIdentifiedMessage msg, Connection sender)
- Overrides:
handleConsumerIdentifiedin classMessageDecoder
-
handleIdentifyEventsAddressed
public void handleIdentifyEventsAddressed(@Nonnull IdentifyEventsAddressedMessage msg, Connection sender)
- Overrides:
handleIdentifyEventsAddressedin classMessageDecoder
-
handleIdentifyEventsGlobal
public void handleIdentifyEventsGlobal(@Nonnull IdentifyEventsGlobalMessage msg, Connection sender)
- Overrides:
handleIdentifyEventsGlobalin classMessageDecoder
-
sendAllIdentifiedMessages
public void sendAllIdentifiedMessages()
Used at start up to emit the required messages, and in response to a IdentifyEvents message
-
handleIdentifyProducers
public void handleIdentifyProducers(@Nonnull IdentifyProducersMessage msg, Connection sender)
- Overrides:
handleIdentifyProducersin classMessageDecoder
-
handleIdentifyConsumers
public void handleIdentifyConsumers(@Nonnull IdentifyConsumersMessage msg, Connection sender)
- Overrides:
handleIdentifyConsumersin classMessageDecoder
-
-