S - the state type of the FiniteStateMachinepublic static class NonBlockingFiniteStateMachine.SubsequentEvent<S extends Enum<S>> extends Object implements LifecycleAwareEvent<S>
NonBlockingFiniteStateMachine.SubsequentEvent is an Event that ensures that another (wrapped) Event to occur if an only if the FiniteStateMachine is at a certain transition count. Should an attempt to process the wrapped Event occur at another transition count, processing of the said event is ignored.
NonBlockingFiniteStateMachine.SubsequentEvents are designed to provide the ability for future scheduled Events to be skipped if another Event has been processed between the time when the NonBlockingFiniteStateMachine.SubsequentEvent was requested to be processed and when it was actually processed. That is, the purpose of this is to allow an Event to be skipped if other Events interleave between the time when the said Event was actually scheduled and when it was actually meant to be processed.
| Constructor and Description |
|---|
SubsequentEvent(Event<S> event)
Constructs a
NonBlockingFiniteStateMachine.SubsequentEvent. |
| Modifier and Type | Method and Description |
|---|---|
S |
getDesiredState(S currentState, ExecutionContext context)
Determines the desired state of the
FiniteStateMachine for the Event given the current state of the FiniteStateMachine. |
boolean |
onAccept(ExecutionContext context)
Called by a
FiniteStateMachine when the LifecycleAwareEvent is initially about to be accepted for processing. |
void |
onProcessed(ExecutionContext context)
Called by a
FiniteStateMachine when the LifecycleAwareEvent has been processed. |
void |
onProcessing(ExecutionContext context)
Called by a
FiniteStateMachine when the LifecycleAwareEvent is about to be processed. |
String |
toString() |
public SubsequentEvent(Event<S> event)
NonBlockingFiniteStateMachine.SubsequentEvent.event - the actual event to processpublic boolean onAccept(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent is initially about to be accepted for processing.onAccept in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Eventtrue if the Event should be accepted, or false if the FiniteStateMachine should ignore the LifecycleAwareEventpublic void onProcessed(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent has been processed.onProcessed in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Eventpublic void onProcessing(ExecutionContext context)
FiniteStateMachine when the LifecycleAwareEvent is about to be processed.onProcessing in interface LifecycleAwareEvent<S extends Enum<S>>context - the ExecutionContext for the Eventpublic S getDesiredState(S currentState, ExecutionContext context)
FiniteStateMachine for the Event given the current state of the FiniteStateMachine.getDesiredState in interface Event<S extends Enum<S>>currentState - the current state of the FiniteStateMachinecontext - the ExecutionContext for the EventFiniteStateMachine or null if no transition is required