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.


Field Summary
static FSMAction skip
           
 
Constructor Summary
LeafState(java.lang.String s)
           
 
Method Summary
 void addTransition(LeafState to, FSMEvent trigger, FSMAction action)
           
 void addTransition(NodeState to, FSMEvent trigger, FSMAction action)
          Adds a transition with this state as source and parameter to as a target.
 void dispatch(FSMEvent trigger, java.lang.Object data, FSMContext fsmc)
          Dispatch an event.
 java.util.Vector getEvents()
          Method to find out which events can be dispatched by this state.
 FSMAction getStateEntryAction()
           
 FSMAction getStateExitAction()
           
 void setStateEntryAction(FSMAction action)
           
 void setStateExitAction(FSMAction action)
           
 java.lang.String toString()
           
 
Methods inherited from class nestedstate.State
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

skip

public static FSMAction skip
Constructor Detail

LeafState

public LeafState(java.lang.String s)
Method Detail

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 transition
to - 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 action
fsmc - 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