Class StateControl
java.lang.Object
org.apache.mina.statemachine.StateControl
Allows for programmatic control of a state machines execution.
The *Now() family of methods move to a new State
immediately and let the new State handle the current Event.
The *Next() family on the other hand let the new State
handle the next Event which is generated which make these method the
programmatic equivalent of using the Transition annotation.
Using the breakAndCall*() and breakAndReturn* methods one
can create sub state machines which behave very much like sub routines.
When calling a state the current state (or the specified returnTo
state) will be pushed on a stack. When returning from a state the last pushed
state will be popped from the stack and used as the new state.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbreakAndCallNext(String state) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent.static voidbreakAndCallNext(String state, String returnTo) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent.static voidbreakAndCallNow(String state) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent.static voidbreakAndCallNow(String state, String returnTo) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent.static voidBreaks the execution of the currentTransitionand tries to find anotherTransitionwith higher weight or aTransitionof a parentStatewhich can handle the currentEvent.static voidbreakAndGotoNext(String state) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent.static voidbreakAndGotoNow(String state) Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent.static voidBreaks the execution of the currentTransitionand lets the last recordedStatehandle the nextEvent.static voidBreaks the execution of the currentTransitionand lets the last recordedStatehandle the currentEvent.
-
Constructor Details
-
StateControl
public StateControl()
-
-
Method Details
-
breakAndContinue
public static void breakAndContinue()Breaks the execution of the currentTransitionand tries to find anotherTransitionwith higher weight or aTransitionof a parentStatewhich can handle the currentEvent. -
breakAndGotoNow
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent.- Parameters:
state- the id of theStateto go to.
-
breakAndGotoNext
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent. Using this method is the programmatic equivalent of using theTransitionannotation.- Parameters:
state- the id of theStateto go to.
-
breakAndCallNow
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent. Before moving to the new state the current state will be recorded. The next call tobreakAndReturnNow()orbreakAndReturnNext()will return to the current state.- Parameters:
state- the id of theStateto call.
-
breakAndCallNext
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent. Before moving to the new state the current state will be recorded. The next call tobreakAndReturnNow()orbreakAndReturnNext()will return to the current state.- Parameters:
state- the id of theStateto call.
-
breakAndCallNow
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the currentEvent. Before moving to the new state the current state will be recorded. The next call tobreakAndReturnNow()orbreakAndReturnNext()will return to the specifiedreturnTostate. -
breakAndCallNext
Breaks the execution of the currentTransitionand lets theStatewith the specified id handle the nextEvent. Before moving to the new state the current state will be recorded. The next call tobreakAndReturnNow()orbreakAndReturnNext()will return to the specifiedreturnTostate. -
breakAndReturnNow
public static void breakAndReturnNow()Breaks the execution of the currentTransitionand lets the last recordedStatehandle the currentEvent. -
breakAndReturnNext
public static void breakAndReturnNext()Breaks the execution of the currentTransitionand lets the last recordedStatehandle the nextEvent.
-