public abstract class FireMachine extends java.lang.Object implements StartOrResumable
For any concrete subclass of ActMachine, the StartOrResumable() interface has to be implemented, in which how the FSM react to MetroII events (or in other words, the state transitions) should be implemented.
Modifier and Type | Class and Description |
---|---|
static class |
FireMachine.State
Predefined states for the wrapped actor.
|
Constructor and Description |
---|
FireMachine(Actor actor)
Constructs an FireMachine wrapper and initialize the MetroII events.
|
Modifier and Type | Method and Description |
---|---|
protected Actor |
actor()
Returns the wrapped actor.
|
FireMachine.State |
getState()
Gets the state of the wrapped actor.
|
metroIIcomm.Event.Builder |
getStateEvent()
Returns the MetroII event associated with the current state.
|
protected metroIIcomm.Event.Builder |
proposeStateEvent()
Returns the MetroII event associated with the current state and set the
state of the event to be PROPOSED.
|
void |
reset()
Resets the state to be PREFIRE_BEGIN.
|
protected void |
setState(FireMachine.State state)
Sets the state of the wrapped actor.
|
void |
wrapup()
Wraps up the firing by reseting.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
startOrResume
public FireMachine(Actor actor)
actor
- the actor whose getfire() is to be wrapped.public metroIIcomm.Event.Builder getStateEvent()
public FireMachine.State getState()
setState(State)
public void reset()
reset
in interface StartOrResumable
public void wrapup()
protected Actor actor()
protected metroIIcomm.Event.Builder proposeStateEvent()
protected void setState(FireMachine.State state)
state
- the state to be set.getState()