|
SMC 6_0_1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstatemap.FSMContext
public abstract class FSMContext
Base class for all SMC-generated application context classes. This class stores the FSM name, current and previous states, the state stack, debugging information and state change listeners.
Field Summary | |
---|---|
protected boolean |
_debugFlag
When this flag is set to true , this class will
print out debug messages. |
protected java.io.PrintStream |
_debugStream
Write debug output to this stream. |
protected java.lang.String |
_name
The FSM name. |
protected State |
_previousState
Stores which state a transition left. |
protected State |
_state
The current state. |
protected java.util.Stack<State> |
_stateStack
This stack is used to store the current state when a push transition is taken. |
protected java.lang.String |
_transition
The current transition name. |
Constructor Summary | |
---|---|
protected |
FSMContext(State initState)
Creates a finite state machine context for the given initial state. |
Method Summary | |
---|---|
void |
addStateChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
clearState()
Places the current state into the previous state sets the current state to null . |
void |
emptyStateStack()
Empties the state stack. |
abstract void |
enterStartState()
Starts the finite state machine running by executing the initial state's entry actions. |
boolean |
getDebugFlag()
When debug is set to true , the state machine
will print messages to the console. |
java.io.PrintStream |
getDebugStream()
Writes the debug output to this stream. |
java.lang.String |
getName()
Returns the FSM name. |
State |
getPreviousState()
If this FSM is in transition, then returns the previous state which the last transition left. |
java.lang.String |
getTransition()
If this FSM is in transition, then returns the transition name. |
boolean |
isInTransition()
Returns true if this FSM is in a transition and
false otherwise. |
void |
popState()
Sets the previous state to the current state and pops the top state off the stack and places it into the current state. |
void |
pushState(State state)
Pushes the current state on top of the state stack and sets the current state to state . |
void |
removeStateChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for the state change property. |
void |
setDebugFlag(boolean flag)
Turns debug output on if flag is true and
off if flag is false . |
void |
setDebugStream(java.io.PrintStream stream)
Sets the debug output stream to the given value. |
void |
setName(java.lang.String name)
Sets the FSM name. |
void |
setState(State state)
Sets the current state to the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient java.lang.String _name
protected transient State _state
null
while in
transition.
protected transient java.lang.String _transition
protected transient State _previousState
null
.
protected transient java.util.Stack<State> _stateStack
protected transient boolean _debugFlag
true
, this class will
print out debug messages.
protected transient java.io.PrintStream _debugStream
Constructor Detail |
---|
protected FSMContext(State initState)
initState
- the finite state machine's start state.Method Detail |
---|
public abstract void enterStartState()
public java.lang.String getName()
public boolean getDebugFlag()
true
, the state machine
will print messages to the console.
true
if debug output is generated.public java.io.PrintStream getDebugStream()
public boolean isInTransition()
true
if this FSM is in a transition and
false
otherwise.
true
if this FSM is in a transition and
false
otherwise.public State getPreviousState() throws java.lang.NullPointerException
null
.
java.lang.NullPointerException
public java.lang.String getTransition()
public void setName(java.lang.String name)
name
- The finite state machine name.public void setDebugFlag(boolean flag)
flag
is true
and
off if flag
is false
.
flag
- true
to turn debuggin on and
false
to turn debugging off.public void setDebugStream(java.io.PrintStream stream)
stream
- The debug output stream.public void setState(State state)
state
- The current state.public void clearState()
null
.
public void pushState(State state)
state
.
state
- The new current state.
java.lang.NullPointerException
- if state
is null
.public void popState() throws java.util.EmptyStackException
java.util.EmptyStackException
- if the state stack is empty.public void emptyStateStack()
public void addStateChangeListener(java.beans.PropertyChangeListener listener)
listener
is null
,
no exception is thrown and no action is taken.
listener
- The PropertyChangeListener to be added.public void removeStateChangeListener(java.beans.PropertyChangeListener listener)
listener
was added more than once
to the same event source, it will be notified one less
time after being removed. If listener
is
null
or was never added, no exception is thrown
and no action is taken.
listener
- The PropertyChangeListener to be removed.
|
SMC 6_0_1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |