public class StateMachine extends Object
State
objects connected by Transitions. Normally you wouldn't create
instances of this class directly but rather use the
State annotation to define
your states and then let StateMachineFactory create a
StateMachine for you.| Constructor and Description |
|---|
StateMachine(Collection<State> states,
String startStateId)
Creates a new instance using the specified
States and start
state. |
StateMachine(State[] states,
String startStateId)
Creates a new instance using the specified
States and start
state. |
| Modifier and Type | Method and Description |
|---|---|
State |
getState(String id)
Returns the
State with the specified id. |
Collection<State> |
getStates()
|
void |
handle(Event event)
Processes the specified
Event through this StateMachine. |
public StateMachine(State[] states, String startStateId)
States and start
state.public State getState(String id) throws NoSuchStateException
State with the specified id.id - the id of the State to return.StateNoSuchStateException - if no matching State could be found.public Collection<State> getStates()
States.public void handle(Event event)
Event through this StateMachine.
Normally you wouldn't call this directly but rather use
StateMachineProxyBuilder to create a proxy for an interface of
your choice. Any method calls on the proxy will be translated into
Event objects and then fed to the StateMachine by the
proxy using this method.event - the Event to be handled.Copyright © 2004–2017 Apache MINA Project. All rights reserved.