Package io.hektor.fsm.impl
Class StateImpl<S extends Enum<S>,C extends Context,D extends Data>
java.lang.Object
io.hektor.fsm.impl.StateImpl<S,C,D>
- All Implemented Interfaces:
State<S,C, D>
public class StateImpl<S extends Enum<S>,C extends Context,D extends Data>
extends Object
implements State<S,C,D>
- Author:
- jonas@jonasborjesson.com
-
Constructor Summary
ConstructorsConstructorDescriptionStateImpl(S state, boolean isInitial, boolean isFinal, boolean isTransient, List<Transition<?, S, C, D>> transitions, Optional<Transition<?, S, C, D>> defaultTransition, BiConsumer<C, D> initialEnterAction, Label initialEnterActionLabel, BiConsumer<C, D> selfEnterAction, Label selfEnterActionLabel, BiConsumer<C, D> enterAction, Label enterActionLabel, BiConsumer<C, D> exitAction, Label exitActionLabel) -
Method Summary
Modifier and TypeMethodDescriptionSee if thisStatewould accept the given event.voidacceptVisitor(FsmVisitor<S, C, D> visitor) Retrieve a list of all other states this state is connected to.Optional<BiConsumer<C,D>> Optional<BiConsumer<C,D>> Optional<BiConsumer<C,D>> Optional<BiConsumer<C,D>> getState()Retrieve the enum value of the state.List<Transition<?,S, C, D>> getTransitionsToState(S state) booleanisFinal()Check whether or not this state is final.booleanisInital()Check whether or not this state is initial.booleanCheck whether or not this state is a transient state.
-
Constructor Details
-
StateImpl
public StateImpl(S state, boolean isInitial, boolean isFinal, boolean isTransient, List<Transition<?, S, C, D>> transitions, Optional<Transition<?, S, C, D>> defaultTransition, BiConsumer<C, D> initialEnterAction, Label initialEnterActionLabel, BiConsumer<C, D> selfEnterAction, Label selfEnterActionLabel, BiConsumer<C, D> enterAction, Label enterActionLabel, BiConsumer<C, D> exitAction, Label exitActionLabel)
-
-
Method Details
-
getTransitionsToState
-
acceptVisitor
-
getState
Description copied from interface:StateRetrieve the enum value of the state. -
getInitialEnterAction
-
getInitialEnterActionLabel
-
getSelfEnterAction
-
getSelfEnterActionLabel
-
getEnterAction
-
getEnterActionLabel
-
getExitAction
-
getExitActionLabel
-
isInital
public boolean isInital()Description copied from interface:StateCheck whether or not this state is initial. -
isFinal
public boolean isFinal()Description copied from interface:StateCheck whether or not this state is final. -
isTransient
public boolean isTransient()Description copied from interface:StateCheck whether or not this state is a transient state. -
getConnectedNodes
Description copied from interface:StateRetrieve a list of all other states this state is connected to. This is just the "forward" connections. I.e., if A is connected to B, then A would return a list of one element with B in it. However, B doesn't really know that A is connected to it so if you'd ask B for all its connections, then A would not be part of that list (unless of course you actually specified that on the B state explicitly) -
accept
Description copied from interface:StateSee if thisStatewould accept the given event.- Specified by:
acceptin interfaceState<S extends Enum<S>,C extends Context, D extends Data> - Parameters:
event- the event to see if it is accepted by this state or not.- Returns:
- if the
Stateaccepts the event, then an theTransitionthat ultimatelely was the one accepting the event will be returned. If not, an emptyOptionalwill be returned.
-