oracle.cle.util.statemachine
Class StateMachine

java.lang.Object
  |
  +--oracle.cle.util.statemachine.StateMachine
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
CLEStateMachine

public class StateMachine
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A (Deterministic) Finite State Machine (FSM) contains:

1. A set of States
2. A transition table (function)
3. A single begin state that is a member of the set of states
4. A set of end states that is a subset of the set of states
(NOTE: We will implement this at the State level, not the machine level).

See Also:
State, Serialized Form

Field Summary
protected  java.lang.String currentState
          The single state that this FSM is currently in
protected  boolean DEBUG
          Set this to true for diagnostic messages
protected  java.lang.String initialState
          The single initial state for this FSM
protected  java.util.Vector states
          The set of states in this FSM
protected  java.util.Stack stateStack
          The history of this FSM
protected  TransitionTable transitionTable
          The transition table function for this FSM
 
Constructor Summary
StateMachine()
          Default Constructor
StateMachine(java.util.Vector stateList, State anInitialState)
          Constructor which sets the states and the begin state for the FSM
StateMachine(java.util.Vector stateList, State anInitialState, TransitionTable aTransitionTable)
          Constructor which sets the states and the begin state for the FSM
 
Method Summary
 java.lang.Object clone()
           
 void debug(java.lang.String text)
          a simple way to print some debug messages out
 java.lang.String dumpStateStack()
          Prints a history of the state machine to a String
 State findState(java.lang.String stateName)
           
 State getCurrentState()
           
 State getInitialState()
           
protected  State getStateGivenItsName(java.lang.String stateName)
           
 java.util.Vector getStates()
           
 TransitionTable getTransitionTable()
           
 void setInitialState(State aState)
           
 void setStates(java.util.Vector aVector)
           
 void setTransitionTable(TransitionTable table)
           
 void start()
          Begins the execution of this State Machine
 void start(State anInitialState)
          Begins the execution of this State Machine in the specified state
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

states

protected java.util.Vector states
The set of states in this FSM

transitionTable

protected TransitionTable transitionTable
The transition table function for this FSM

initialState

protected java.lang.String initialState
The single initial state for this FSM

currentState

protected java.lang.String currentState
The single state that this FSM is currently in

stateStack

protected java.util.Stack stateStack
The history of this FSM

DEBUG

protected boolean DEBUG
Set this to true for diagnostic messages
Constructor Detail

StateMachine

public StateMachine()
Default Constructor

StateMachine

public StateMachine(java.util.Vector stateList,
                    State anInitialState)
Constructor which sets the states and the begin state for the FSM

StateMachine

public StateMachine(java.util.Vector stateList,
                    State anInitialState,
                    TransitionTable aTransitionTable)
Constructor which sets the states and the begin state for the FSM
Method Detail

start

public void start()
Begins the execution of this State Machine

start

public void start(State anInitialState)
Begins the execution of this State Machine in the specified state

setInitialState

public void setInitialState(State aState)

getInitialState

public State getInitialState()

setStates

public void setStates(java.util.Vector aVector)

getStates

public java.util.Vector getStates()

getTransitionTable

public TransitionTable getTransitionTable()

setTransitionTable

public void setTransitionTable(TransitionTable table)

getCurrentState

public State getCurrentState()

dumpStateStack

public java.lang.String dumpStateStack()
Prints a history of the state machine to a String

debug

public void debug(java.lang.String text)
a simple way to print some debug messages out

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object

findState

public State findState(java.lang.String stateName)

getStateGivenItsName

protected State getStateGivenItsName(java.lang.String stateName)


Copyright © 2003 ORACLE Corp. All Rights Reserved.