public class FSMImp extends Object implements FSM
| Constructor and Description |
|---|
FSMImp(Object eventsource,
TxState initialstate)
Creates a new instance with a given event source.
|
FSMImp(TxState initialstate)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEnterListener(Hashtable<TxState,Set<EventListener>> listeners,
EventListener lstnr,
TxState state)
Help function for adding enter listeners.
|
void |
addFSMEnterListener(FSMEnterListener lstnr,
TxState state)
Add an enter event listener.
|
void |
addFSMPreEnterListener(FSMPreEnterListener lstnr,
TxState state) |
void |
addFSMPreTransitionListener(FSMPreTransitionListener lstnr,
TxState from,
TxState to) |
void |
addFSMTransitionListener(FSMTransitionListener lstnr,
TxState from,
TxState to) |
protected void |
addTransitionListener(Hashtable<TxState,Hashtable<TxState,Set<EventListener>>> listeners,
EventListener lstnr,
TxState from,
TxState to)
Help function for adding transition listeners.
|
TxState |
getState() |
protected void |
notifyListeners(Hashtable<TxState,Hashtable<TxState,Set<EventListener>>> listeners,
TxState from,
TxState to,
boolean pre)
Notify transition listeners.
|
protected void |
notifyListeners(Hashtable<TxState,Set<EventListener>> listeners,
TxState state,
boolean pre)
Notify the enter listeners.
|
void |
setState(TxState state) |
public FSMImp(TxState initialstate)
transitiontable - The transitiontable with valid
transitions.initialstate - The initial state of the FSM.public FSMImp(Object eventsource, TxState initialstate)
eventsource - The object to be used as source of events.transitiontable - The transitiontable for state changes.initialstate - The initial state of the FSM.protected void addEnterListener(Hashtable<TxState,Set<EventListener>> listeners, EventListener lstnr, TxState 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<TxState,Hashtable<TxState,Set<EventListener>>> listeners, EventListener lstnr, TxState from, TxState 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<TxState,Set<EventListener>> listeners, TxState 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<TxState,Hashtable<TxState,Set<EventListener>>> listeners, TxState from, TxState to, boolean pre)
listeners - One of the transition listener tables.from - The initial state.to - The end state.pre - True iff before transition.public TxState getState()
public void setState(TxState state) throws IllegalStateException
setState in interface StateMutableIllegalStateException - if the new state transition to
the new state is not allowed.StateMutablepublic void addFSMEnterListener(FSMEnterListener lstnr, TxState state)
FSMEnterEventSourceaddFSMEnterListener in interface FSMEnterEventSourcelstnr - The listener.state - The state to listen on.FSMEnterEventSourcepublic void addFSMPreEnterListener(FSMPreEnterListener lstnr, TxState state)
addFSMPreEnterListener in interface FSMPreEnterEventSourceFSMPreEnterEventSourcepublic void addFSMTransitionListener(FSMTransitionListener lstnr, TxState from, TxState to)
addFSMTransitionListener in interface FSMTransitionEventSourceFSMTransitionEventSourcepublic void addFSMPreTransitionListener(FSMPreTransitionListener lstnr, TxState from, TxState to)
addFSMPreTransitionListener in interface FSMPreTransitionEventSourceFSMPreTransitionEventSourceCopyright © 2016. All Rights Reserved.