org.zkoss.fsm
Class MacroStateCtx<E,C,IN,E2,C2>

java.lang.Object
  extended by org.zkoss.fsm.StateCtx<E,C,IN>
      extended by 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. Upon StateCtx.onLand(IN, C, E) is called on the state, StateMachine.start(Object) is triggered on the inner machine 2. Upon StateCtx.onReturn(IN, C) is called on the state, StateMachine.run(Object) is triggered on the inner machine 3. Upon StateCtx.onLeave(IN, C, E) is called on the state, the inner machine is terminated. 4. Upon StateCtx.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
protected  StateMachine<E2,C2,IN> _submachine
           
 
Fields inherited from class org.zkoss.fsm.StateCtx
_machine, _minorReturners, _minorTransitionListeners, _minorTransitions, _returnAll, _returners, _transitionListeners, _transitions
 
Constructor Summary
MacroStateCtx(StateMachine<E2,C2,IN> submachine)
          Construct a macro state, which consists of a state machine by itself.
 
Method Summary
protected  void onLand(IN input, C inputClass, E origin)
          This method is called when the machine enters this state
protected  void onLeave(IN input, C inputClass, E destination)
          This method is called when the machine leaves this state
protected  void onReturn(IN input, C inputClass)
          This method is called when the machine returns to the same state
protected  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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

Overrides:
onLand in class StateCtx<E,C,IN>

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

Overrides:
onReturn in class StateCtx<E,C,IN>

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

Overrides:
onLeave in class StateCtx<E,C,IN>

onStop

protected void onStop(boolean endOfInput)
Description copied from class: StateCtx
This method is called when the machine stops on this state

Overrides:
onStop in class StateCtx<E,C,IN>


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo