nestedstate
Class FSMContext
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--nestedstate.FSMContext
- public class FSMContext
- extends java.util.Hashtable
This is the context of a FSM. A context holds a reference to the current state
and also functions as a repository for objects. To do that it extends from
java.util.Hashtable. Objects can be stored with the hashtable's put method and
retrieved with the hashtables get method.
- See Also:
- Serialized Form
| Methods inherited from class java.util.Hashtable |
clear,
clone,
contains,
containsKey,
containsValue,
elements,
entrySet,
equals,
get,
hashCode,
isEmpty,
keys,
keySet,
put,
putAll,
rehash,
remove,
size,
toString,
values |
| Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
FSMContext
public FSMContext(NodeState root)
- Create a new context with s as the first state
- Parameters:
s - The first state
FSMContext
public FSMContext(NodeState root,
FSMAction i)
- Create a new context with s as the first state. an then execute i to
initialize the context.
- Parameters:
s - The first statei - The initial action
setRoot
public void setRoot(NodeState r)
getRoot
public NodeState getRoot()
getEvents
public java.util.Vector getEvents()
- Find out what events can be sent to the current state
- Returns:
- A list of events
initialize
public void initialize()
- Initialize the context. Clear the hashtable. Set first state and
execute initial action.
setInitialAction
public void setInitialAction(FSMAction a)
getInitialAction
public FSMAction getInitialAction()
dispatch
public void dispatch(FSMEvent e,
java.lang.Object data)
- Dispatch an event e.
- Parameters:
e - The event
- @param data Some additional data
getState
public State getState()