nestedstate
Class State
java.lang.Object
|
+--nestedstate.State
- Direct Known Subclasses:
- LeafState, NodeState
- public abstract class State
- extends java.lang.Object
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 |
State(java.lang.String s)
Initilizes a stateobject with name s. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
State
public State(java.lang.String s)
- Initilizes a stateobject with name s.
- Parameters:
s - The name of the new state
setName
public void setName(java.lang.String s)
getName
public java.lang.String getName()
toString
public java.lang.String toString()
- Convenience method that returns the name of this state.
- Overrides:
- toString in class java.lang.Object
addTransition
public abstract void addTransition(LeafState to,
FSMEvent trigger,
FSMAction action)
- Adds a transition with this state as source and parameter to as a
target.
- Parameters:
trigger - The event that triggers the transitionto - The target leafstate.action - The associated action
addTransition
public abstract void addTransition(NodeState to,
FSMEvent trigger,
FSMAction action)
- Adds a transition with this state as source and parameter to as a
target.
- Parameters:
trigger - The event that triggers the transitionto - The target nodestate.action - The associated action
dispatch
public abstract 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.
getEvents
public abstract java.util.Vector getEvents()
- Method to find out which events can be dispatched by this state.
- Returns:
- A vector with the events