nestedstate
Class LeafState
java.lang.Object
|
+--nestedstate.State
|
+--nestedstate.LeafState
- public class LeafState
- extends State
This class models a State. A state has a name and entry /exit actions.
Further state also contains a dispatch mechanism for incoming events.
|
Constructor Summary |
LeafState(java.lang.String s)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
skip
public static FSMAction skip
LeafState
public LeafState(java.lang.String s)
setStateEntryAction
public void setStateEntryAction(FSMAction action)
getStateEntryAction
public FSMAction getStateEntryAction()
setStateExitAction
public void setStateExitAction(FSMAction action)
getStateExitAction
public FSMAction getStateExitAction()
addTransition
public void addTransition(NodeState to,
FSMEvent trigger,
FSMAction action)
- Adds a transition with this state as source and parameter to as a
target. Since to is a node state this method calls addTransition
recursively to set the targetstate to a LeafState.
- Parameters:
trigger - The event that triggers the transitionto - The target state.action - The associated action- Overrides:
- addTransition in class State
addTransition
public void addTransition(LeafState to,
FSMEvent trigger,
FSMAction action)
- Overrides:
- addTransition in class State
dispatch
public void dispatch(FSMEvent trigger,
java.lang.Object data,
FSMContext fsmc)
- Dispatch an event.
- Parameters:
trigger - The event that needs to be dispatched. The correct
transition is located and than executed.data - Some additional data that may be needed by the actionfsmc - The context in which the action is executed. This may be
useful for retrieving global variables.- Overrides:
- dispatch in class State
getEvents
public java.util.Vector getEvents()
- Method to find out which events can be dispatched by this state.
- Returns:
- A vector with the events
- Overrides:
- getEvents in class State
toString
public java.lang.String toString()
- Overrides:
- toString in class State