public interface Definition<S extends Enum<S>,C extends Context,D extends Data>
| Modifier and Type | Method and Description |
|---|---|
FSM |
newInstance(Object uuid,
C context,
D data) |
FSM |
newInstance(Object uuid,
C context,
D data,
BiConsumer<S,Object> onUnhandledEvent,
TransitionListener<S> transitionListener)
Create a new
FSM based off of this Definition and assign
a unique UUID to this state machine. |
FSM newInstance(Object uuid, C context, D data, BiConsumer<S,Object> onUnhandledEvent, TransitionListener<S> transitionListener)
FSM based off of this Definition and assign
a unique UUID to this state machine. The FSM itself doesn't actually use the
UUID other but may be important for the applications who actually are using
this FSM.
Also pass in a handler for any events that doesn't match the FSM. This allow you
to take action if there are any events that has been missed when creating the
FSM. A common best practice is to at the very least log on WARN so your systems
can alert you to the fact that your FSM is missing a transition.uuid - context - data - onUnhandledEvent - Copyright © 2019. All rights reserved.