Package io.hektor.fsm
Interface FSM<S extends Enum<S>,C extends Context,D extends Data>
- All Known Implementing Classes:
FsmImpl
- Author:
- jonas@jonasborjesson.com
-
Method Summary
Modifier and TypeMethodDescriptiongetState()The state in which this FSM currently is.booleanbooleanThe FSM is in its terminated state if it has reached the final state.static <S extends Enum<S>>
ContextTypeBuildStep<S>voidDeliver an event to thisFSM.voidreStartAndEnter(S state) Re-start the FSM and enter the specified state.voidstart()
-
Method Details
-
start
void start()You must callstart()on theFSMbefore it can be used. This will cause the FSM to "transition" from a null state to its initial state. Any enter actions associated with the initial state will naturally now be called. Note: calling this method when the FSM is already started will silently be ignored. -
isStarted
boolean isStarted() -
isTerminated
boolean isTerminated()The FSM is in its terminated state if it has reached the final state.- Returns:
-
reStartAndEnter
Re-start the FSM and enter the specified state. The entry actions associated with this state will be executed. This is useful if your FSM throw an exception and you want to control how to deal with that (and potentially let the FSM start over) or if you have suspended/resumed the FSM (e.g. my serializing it to another JVM) and you want to continue were you left off.- Parameters:
state-- Throws:
IllegalArgumentException- in case the state is null
-
onEvent
Deliver an event to thisFSM.- Parameters:
event-
-
getState
S getState()The state in which this FSM currently is. -
of
-