|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atomikos.finitestates.FSMImp
public class FSMImp
Implementation of a finite state machine. The following consistency is provided:
Constructor Summary | |
---|---|
FSMImp(Object eventsource,
TransitionTable transitiontable,
Object initialstate)
Creates a new instance with a given event source. |
|
FSMImp(TransitionTable transitiontable,
Object initialstate)
Constructor. |
Method Summary | |
---|---|
protected void |
addEnterListener(Hashtable listeners,
Object lstnr,
Object state)
Help function for adding enter listeners. |
void |
addFSMEnterListener(FSMEnterListener lstnr,
Object state)
Add an enter event listener. |
void |
addFSMPreEnterListener(FSMPreEnterListener lstnr,
Object state)
|
void |
addFSMPreTransitionListener(FSMPreTransitionListener lstnr,
Object from,
Object to)
|
void |
addFSMTransitionListener(FSMTransitionListener lstnr,
Object from,
Object to)
|
protected void |
addTransitionListener(Hashtable listeners,
Object lstnr,
Object from,
Object to)
Help function for adding transition listeners. |
Object |
getState()
|
protected void |
notifyListeners(Hashtable listeners,
Object state,
boolean pre)
Notify the enter listeners. |
protected void |
notifyListeners(Hashtable listeners,
Object from,
Object to,
boolean pre)
Notify transition listeners. |
void |
setState(Object state)
To set a new state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FSMImp(TransitionTable transitiontable, Object initialstate)
transitiontable
- The transitiontable with valid
transitions.initialstate
- The initial state of the FSM.public FSMImp(Object eventsource, TransitionTable transitiontable, Object initialstate)
eventsource
- The object to be used as source of events.transitiontable
- The transitiontable for state changes.initialstate
- The initial state of the FSM.Method Detail |
---|
protected void addEnterListener(Hashtable listeners, Object lstnr, Object state)
listeners
- One of the listener tables.lstnr
- The listener to add.state
- The state for which the listener wants to be notified.protected void addTransitionListener(Hashtable listeners, Object lstnr, Object from, Object to)
listeners
- One of the transition listener tables.lstnr
- The listener to add.from
- The start state of the transition.to
- The end state of the transition.protected void notifyListeners(Hashtable listeners, Object state, boolean pre)
listeners
- One of the enter listener tables.state
- The state about to enter (or entered).pre
- True iff before entering.protected void notifyListeners(Hashtable listeners, Object from, Object to, boolean pre)
listeners
- One of the transition listener tables.from
- The initial state.to
- The end state.pre
- True iff before transition.public Object getState()
getState
in interface Stateful
FSM
public void setState(Object state) throws IllegalStateException
StateMutable
setState
in interface StateMutable
state
- The new state.
IllegalStateException
- if the new state transition to
the new state is not allowed.StateMutable
public void addFSMEnterListener(FSMEnterListener lstnr, Object state)
FSMEnterEventSource
addFSMEnterListener
in interface FSMEnterEventSource
lstnr
- The listener.state
- The state to listen on.FSMEnterEventSource
public void addFSMPreEnterListener(FSMPreEnterListener lstnr, Object state)
addFSMPreEnterListener
in interface FSMPreEnterEventSource
FSMPreEnterEventSource
public void addFSMTransitionListener(FSMTransitionListener lstnr, Object from, Object to)
addFSMTransitionListener
in interface FSMTransitionEventSource
FSMTransitionEventSource
public void addFSMPreTransitionListener(FSMPreTransitionListener lstnr, Object from, Object to)
addFSMPreTransitionListener
in interface FSMPreTransitionEventSource
FSMPreTransitionEventSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |