de.esw.eengine.fsm
Class FSM

java.lang.Object
  extended by de.esw.eengine.fsm.FSM
Direct Known Subclasses:
WTKStateMachine

public class FSM
extends java.lang.Object

Implementation of a deterministic finite state machine (FSM/FSA).

Since:
1.0
Version:
$Id: FSM.java 210 2005-07-23 09:01:14Z markusw $
Author:
markusw
See Also:
update(float, Object)

Constructor Summary
FSM()
           
FSM(State startState)
           
 
Method Summary
 State getStartState()
           
 void reset()
          Resets this finite state machine to the startState State given during construction.
 void setStartState(State startState)
           
 void start()
          Enters the start state of the FSM
 void start(java.lang.Object input)
          Enters the start state of the FSM
 void update(float delta)
           
 void update(float delta, java.lang.Object input)
          Triggers always the first Transition returned by the current state.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSM

public FSM()

FSM

public FSM(State startState)
Parameters:
startState - Start State for this FSM
Method Detail

update

public void update(float delta)
            throws EEngineException
Parameters:
delta - Delta time since last call
Throws:
EEngineException - Thrown if no startState State is defined
See Also:
IUpdateable.update(float)

update

public void update(float delta,
                   java.lang.Object input)
            throws EEngineException
Triggers always the first Transition returned by the current state. Therefore this is considered as deterministic behaviour even if there are more than one possible Transitions to be triggered. For nondeterministic behaviour override this class with some scheme you want for Transition selection.

Parameters:
delta - Delta time since last call
input - Generic input object for process method
Throws:
EEngineException - Thrown if no startState State is defined

start

public void start()
Enters the start state of the FSM


start

public void start(java.lang.Object input)
Enters the start state of the FSM

Parameters:
input - Generic input object for start state

reset

public void reset()
Resets this finite state machine to the startState State given during construction.


getStartState

public final State getStartState()
Returns:
Returns the startState.

setStartState

public final void setStartState(State startState)
Parameters:
startState - The startState to set.