- java.lang.Object
-
- io.github.interacto.fsm.Transition<E>
-
- io.github.interacto.fsm.SubFSMTransition<E>
-
- Type Parameters:
E- The type of events the FSM processes.
public class SubFSMTransition<E> extends Transition<E>
A transition that refers to another FSM. Entering this transition starts the underlying sub-FSM. To leave the transition, the sub-FSM must end.
-
-
Field Summary
-
Fields inherited from class io.github.interacto.fsm.Transition
src, tgt
-
-
Constructor Summary
Constructors Constructor Description SubFSMTransition(OutputState<E> srcState, InputState<E> tgtState, FSM<E> fsm)Creates the transition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaccept(E event)Optional<InputState<E>>execute(E event)Executes the transition.Set<Object>getAcceptedEvents()protected booleanisGuardOK(E event)voiduninstall()Clean the transition when not used anymore.-
Methods inherited from class io.github.interacto.fsm.Transition
action
-
-
-
-
Constructor Detail
-
SubFSMTransition
public SubFSMTransition(OutputState<E> srcState, InputState<E> tgtState, FSM<E> fsm)
Creates the transition.- Parameters:
srcState- The source state of the transition.tgtState- The output state of the transition.fsm- The inner FSM that composes the transition.- Throws:
IllegalArgumentException- If one of the states is null.
-
-
Method Detail
-
execute
public Optional<InputState<E>> execute(E event)
Description copied from class:TransitionExecutes the transition.- Overrides:
executein classTransition<E>- Parameters:
event- The event to process.- Returns:
- The potential output state.
-
accept
protected boolean accept(E event)
- Specified by:
acceptin classTransition<E>
-
isGuardOK
protected boolean isGuardOK(E event)
- Specified by:
isGuardOKin classTransition<E>
-
getAcceptedEvents
public Set<Object> getAcceptedEvents()
- Specified by:
getAcceptedEventsin classTransition<E>- Returns:
- The set of events accepted by the transition.
-
uninstall
public void uninstall()
Description copied from class:TransitionClean the transition when not used anymore.- Overrides:
uninstallin classTransition<E>
-
-