Package org.zkoss.fsm
Class MacroStateCtx<E,C,IN,E2,C2>
- java.lang.Object
-
- org.zkoss.fsm.StateCtx<E,C,IN>
-
- org.zkoss.fsm.MacroStateCtx<E,C,IN,E2,C2>
-
public class MacroStateCtx<E,C,IN,E2,C2> extends StateCtx<E,C,IN>
The real power of StateMachine. This extended state allows you to define a sub-StateMachine in a state. The life cycle of the inner state machine is completely determined by the outer one: 1. UponStateCtx.onLand(IN, C, E)
is called on the state,StateMachine.start(Object)
is triggered on the inner machine 2. UponStateCtx.onReturn(IN, C)
is called on the state,StateMachine.run(Object)
is triggered on the inner machine 3. UponStateCtx.onLeave(IN, C, E)
is called on the state, the inner machine is terminated. 4. UponStateCtx.onStop(boolean)
is called on the state,StateMachine.onStop(boolean)
is triggered on the inner machine- Since:
- 6.0.0
- Author:
- simonpai
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.zkoss.fsm.StateCtx
StateCtx.TransitionListener<IN,C>
-
-
Field Summary
Fields Modifier and Type Field Description protected StateMachine<E2,C2,IN>
_submachine
-
Fields inherited from class org.zkoss.fsm.StateCtx
_machine, _minorReturners, _minorTransitionListeners, _minorTransitions, _returnAll, _returners, _transitionListeners, _transitions
-
-
Constructor Summary
Constructors Constructor Description MacroStateCtx(StateMachine<E2,C2,IN> submachine)
Construct a macro state, which consists of a state machine by itself.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
onLand(IN input, C inputClass, E origin)
This method is called when the machine enters this stateprotected void
onLeave(IN input, C inputClass, E destination)
This method is called when the machine leaves this stateprotected void
onReturn(IN input, C inputClass)
This method is called when the machine returns to the same stateprotected void
onStop(boolean endOfInput)
This method is called when the machine stops on this state-
Methods inherited from class org.zkoss.fsm.StateCtx
addMinorRoute, addMinorRoute, addMinorRoutes, addMinorRoutes, addMinorTransition, addMinorTransition, addMinorTransitions, addMinorTransitions, addReturningClasses, addReturningClasses, addReturningInputs, addReturningInputs, addRoute, addRoute, addRoutes, addRoutes, addTransition, addTransition, addTransitions, addTransitions, getDestination, init, isLeaving, isReturning, isReturningAll, onReject, setMaster, setReturningAll
-
-
-
-
Field Detail
-
_submachine
protected final StateMachine<E2,C2,IN> _submachine
-
-
Constructor Detail
-
MacroStateCtx
public MacroStateCtx(StateMachine<E2,C2,IN> submachine)
Construct a macro state, which consists of a state machine by itself.
-
-
Method Detail
-
onLand
protected void onLand(IN input, C inputClass, E origin)
Description copied from class:StateCtx
This method is called when the machine enters this state
-
onReturn
protected void onReturn(IN input, C inputClass)
Description copied from class:StateCtx
This method is called when the machine returns to the same state
-
onLeave
protected void onLeave(IN input, C inputClass, E destination)
Description copied from class:StateCtx
This method is called when the machine leaves this state
-
-