| Constructor and Description |
|---|
StrictMachine(org.slf4j.Logger logger,
java.util.concurrent.Executor executor,
ActionProxy<S,E> actionProxy,
S initialState,
java.util.List<Transition<S,E>> transitions,
java.util.List<TransitionAction<S,E>> transitionActions) |
StrictMachine(org.slf4j.Logger logger,
java.util.Map<java.lang.String,java.lang.String> mdc,
java.util.concurrent.Executor executor,
ActionProxy<S,E> actionProxy,
S initialState,
java.util.List<Transition<S,E>> transitions,
java.util.List<TransitionAction<S,E>> transitionActions) |
| Modifier and Type | Method and Description |
|---|---|
void |
fireEvent(E event)
Fire an event for the FSM to evaluate.
|
void |
fireEvent(E event,
java.util.function.Consumer<S> stateConsumer)
Fire an event for the FSM to evaluate, providing a callback that will be invoked when the event is evaluated.
|
S |
fireEventBlocking(E event)
Fire an event for the FSM to evaluate and block waiting until the state transitioned to as a result of
evaluating
event is available. |
<T> T |
getFromContext(java.util.function.Function<FsmContext<S,E>,T> get)
Provides safe access to the
FsmContext in order to retrieve a value from it. |
S |
getState()
Get the current state of the FSM.
|
public StrictMachine(org.slf4j.Logger logger,
java.util.concurrent.Executor executor,
ActionProxy<S,E> actionProxy,
S initialState,
java.util.List<Transition<S,E>> transitions,
java.util.List<TransitionAction<S,E>> transitionActions)
public StrictMachine(org.slf4j.Logger logger,
java.util.Map<java.lang.String,java.lang.String> mdc,
java.util.concurrent.Executor executor,
ActionProxy<S,E> actionProxy,
S initialState,
java.util.List<Transition<S,E>> transitions,
java.util.List<TransitionAction<S,E>> transitionActions)
public S getState()
Fsmpublic void fireEvent(E event)
Fsm
The subsequent state transition may occur asynchronously. There is no guarantee that a subsequent call to
Fsm.getState() reflects a state arrived at via evaluation of this event.
fireEvent in interface Fsm<S,E>event - the event to evaluate.Fsm.fireEvent(Object, Consumer)public void fireEvent(E event, java.util.function.Consumer<S> stateConsumer)
Fsmpublic S fireEventBlocking(E event) throws java.lang.InterruptedException
Fsmevent is available.fireEventBlocking in interface Fsm<S,E>event - the event to evaluate.event.java.lang.InterruptedException - if interrupted while blocking.public <T> T getFromContext(java.util.function.Function<FsmContext<S,E>,T> get)
FsmFsmContext in order to retrieve a value from it.getFromContext in interface Fsm<S,E>T - the type of the value being retrieved.get - the Function provided access to the context.context.