|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.fsm.StateCtx<E,C,IN>
public class StateCtx<E,C,IN>
A context for a State in a StateMachine, holding returning and transition information.
Nested Class Summary | |
---|---|
static interface |
StateCtx.TransitionListener<IN,C>
|
Field Summary | |
---|---|
protected StateMachine<E,C,IN> |
_machine
|
protected java.util.Set<IN> |
_minorReturners
|
protected java.util.Map<IN,StateCtx.TransitionListener<IN,C>> |
_minorTransitionListeners
|
protected java.util.Map<IN,E> |
_minorTransitions
|
protected boolean |
_returnAll
|
protected java.util.Set<C> |
_returners
|
protected java.util.Map<C,StateCtx.TransitionListener<IN,C>> |
_transitionListeners
|
protected java.util.Map<C,E> |
_transitions
|
Constructor Summary | |
---|---|
StateCtx()
Creates a new state context |
Method Summary | |
---|---|
StateCtx<E,C,IN> |
addMinorRoute(IN input,
E destination)
Add a transition for a character. |
StateCtx<E,C,IN> |
addMinorRoute(IN input,
E destination,
StateCtx.TransitionListener<IN,C> callback)
Add a transition for a character with callback. |
StateCtx<E,C,IN> |
addMinorRoutes(E destination,
IN... inputs)
Add multiple transitions for characters. |
StateCtx<E,C,IN> |
addMinorRoutes(E destination,
StateCtx.TransitionListener<IN,C> callback,
IN... inputs)
Add multiple transitions for characters with a callback. |
StateCtx<E,C,IN> |
addMinorTransition(IN input,
E destination)
Add a transition for a character. |
StateCtx<E,C,IN> |
addMinorTransition(IN input,
E destination,
StateCtx.TransitionListener<IN,C> callback)
Add a transition for a character with a callback |
StateCtx<E,C,IN> |
addMinorTransitions(E destination,
IN... inputs)
Add multiple transitions for characters |
StateCtx<E,C,IN> |
addMinorTransitions(E destination,
StateCtx.TransitionListener<IN,C> callback,
IN... inputs)
Add multiple transitions for characters with a callback |
StateCtx<E,C,IN> |
addReturningClasses(C... inputClasses)
Add an input class for returning to this state |
StateCtx<E,C,IN> |
addReturningClasses(java.util.Collection<C> collection)
Add multiple input classes for returning to this state |
StateCtx<E,C,IN> |
addReturningInputs(java.util.Collection<IN> collection)
Add input characters for returning to this state |
StateCtx<E,C,IN> |
addReturningInputs(IN... inputs)
Add input characters for returning to this state |
StateCtx<E,C,IN> |
addRoute(C inputClass,
E destination)
Add a transition. |
StateCtx<E,C,IN> |
addRoute(C inputClass,
E destination,
StateCtx.TransitionListener<IN,C> callback)
Add a transition with callback. |
StateCtx<E,C,IN> |
addRoutes(E destination,
C... inputClasses)
Add multiple transitions. |
StateCtx<E,C,IN> |
addRoutes(E destination,
StateCtx.TransitionListener<IN,C> callback,
C... inputClasses)
Add multiple transitions with a callback. |
StateCtx<E,C,IN> |
addTransition(C inputClass,
E destination)
Add a transition rule |
StateCtx<E,C,IN> |
addTransition(C inputClass,
E destination,
StateCtx.TransitionListener<IN,C> callback)
Add a transition rule with a callback |
StateCtx<E,C,IN> |
addTransitions(E destination,
C... inputClasses)
Add multiple transitions |
StateCtx<E,C,IN> |
addTransitions(E destination,
StateCtx.TransitionListener<IN,C> callback,
C... inputClasses)
Add multiple transitions with a callback |
E |
getDestination(IN input,
C inputClass)
Returns the destination state upon meeting the character or the class. |
protected void |
init()
Initialization method called at the constructor |
boolean |
isLeaving(IN input,
C inputClass)
Returns true if the machine is leaving this state upon meeting the character or the class. |
boolean |
isReturning(IN input,
C inputClass)
Returns true if this state returns to itself upon meeting the character or the class. |
boolean |
isReturningAll()
Returns true if this state returns to itself by default, unless meeting specified characters or classes. |
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 |
onReject(IN input,
C inputClass)
This method is called when the machine rejects the input on 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 |
protected StateCtx<E,C,IN> |
setMaster(StateMachine<E,C,IN> master)
Sets the owner state machine. |
StateCtx<E,C,IN> |
setReturningAll(boolean returnAll)
Set whether returns to this state upon meeting unspecified characters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StateMachine<E,C,IN> _machine
protected boolean _returnAll
protected final java.util.Set<C> _returners
protected final java.util.Set<IN> _minorReturners
protected final java.util.Map<C,E> _transitions
protected final java.util.Map<C,StateCtx.TransitionListener<IN,C>> _transitionListeners
protected final java.util.Map<IN,E> _minorTransitions
protected final java.util.Map<IN,StateCtx.TransitionListener<IN,C>> _minorTransitionListeners
Constructor Detail |
---|
public StateCtx()
Method Detail |
---|
protected StateCtx<E,C,IN> setMaster(StateMachine<E,C,IN> master)
protected void init()
public StateCtx<E,C,IN> addReturningClasses(C... inputClasses)
public StateCtx<E,C,IN> addReturningClasses(java.util.Collection<C> collection)
public StateCtx<E,C,IN> addReturningInputs(IN... inputs)
public StateCtx<E,C,IN> addReturningInputs(java.util.Collection<IN> collection)
public StateCtx<E,C,IN> setReturningAll(boolean returnAll)
public StateCtx<E,C,IN> addTransition(C inputClass, E destination)
public StateCtx<E,C,IN> addTransition(C inputClass, E destination, StateCtx.TransitionListener<IN,C> callback)
public StateCtx<E,C,IN> addTransitions(E destination, C... inputClasses)
public StateCtx<E,C,IN> addTransitions(E destination, StateCtx.TransitionListener<IN,C> callback, C... inputClasses)
public StateCtx<E,C,IN> addRoute(C inputClass, E destination)
addTransition(Object, Object)
,
and only differs in return value.
public StateCtx<E,C,IN> addRoute(C inputClass, E destination, StateCtx.TransitionListener<IN,C> callback)
addTransition(Object, Object, TransitionListener)
,
and only differs in return value.
public StateCtx<E,C,IN> addRoutes(E destination, C... inputClasses)
addTransitions(Object, Object...)
,
and only differs in return value.
public StateCtx<E,C,IN> addRoutes(E destination, StateCtx.TransitionListener<IN,C> callback, C... inputClasses)
addTransitions(Object, TransitionListener, Object...)
,
and only differs in return value.
public StateCtx<E,C,IN> addMinorTransition(IN input, E destination)
public StateCtx<E,C,IN> addMinorTransition(IN input, E destination, StateCtx.TransitionListener<IN,C> callback)
public StateCtx<E,C,IN> addMinorTransitions(E destination, IN... inputs)
public StateCtx<E,C,IN> addMinorTransitions(E destination, StateCtx.TransitionListener<IN,C> callback, IN... inputs)
public StateCtx<E,C,IN> addMinorRoute(IN input, E destination)
addMinorRoute(Object, Object)
,
and only differs in return value.
public StateCtx<E,C,IN> addMinorRoute(IN input, E destination, StateCtx.TransitionListener<IN,C> callback)
addMinorTransition(Object, Object, TransitionListener)
,
and only differs in return value.
public StateCtx<E,C,IN> addMinorRoutes(E destination, IN... inputs)
addMinorTransitions(Object, Object...)
,
and only differs in return value.
public StateCtx<E,C,IN> addMinorRoutes(E destination, StateCtx.TransitionListener<IN,C> callback, IN... inputs)
addMinorTransitions(Object, TransitionListener, Object...)
,
and only differs in return value.
public boolean isReturningAll()
public boolean isReturning(IN input, C inputClass)
public boolean isLeaving(IN input, C inputClass)
public E getDestination(IN input, C inputClass)
protected void onLand(IN input, C inputClass, E origin)
protected void onReturn(IN input, C inputClass)
protected void onReject(IN input, C inputClass)
protected void onLeave(IN input, C inputClass, E destination)
protected void onStop(boolean endOfInput)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |