|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.statemachine.State
public class State
Represents a state in a StateMachine
. 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.
State
s inherits Transition
s from
their parent. A State
can override any of the parents
Transition
s. When an Event
is processed the Transition
s
of the current State
will be searched for a Transition
which
can handle the event. If none is found the State
's parent will be
searched and so on.
Constructor Summary | |
---|---|
State(String id)
Creates a new State with the specified id. |
|
State(String id,
State parent)
Creates a new State with the specified id and parent. |
Method Summary | |
---|---|
State |
addTransition(Transition transition)
Adds an outgoing Transition to this State with weight 0. |
State |
addTransition(Transition transition,
int weight)
Adds an outgoing Transition to this State with the
specified weight. |
boolean |
equals(Object o)
|
String |
getId()
Returns the id of this State . |
State |
getParent()
Returns the parent State . |
List<Transition> |
getTransitions()
Returns an unmodifiable List of Transition s going out
from this State . |
int |
hashCode()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public State(String id)
State
with the specified id.
id
- the unique id of this State
.public State(String id, State parent)
State
with the specified id and parent.
id
- the unique id of this State
.parent
- the parent State
.Method Detail |
---|
public String getId()
State
.
public State getParent()
State
.
null
if this State
has no
parent.public List<Transition> getTransitions()
List
of Transition
s going out
from this State
.
Transition
s.public State addTransition(Transition transition)
Transition
to this State
with weight 0.
transition
- the Transition
to add.
State
.addTransition(Transition, int)
public State addTransition(Transition transition, int weight)
Transition
to this State
with the
specified weight. The higher the weight the less important a
Transition
is. If two Transition
s match the same
Event
the Transition
with the lower weight will
be executed.
transition
- the Transition
to add.
State
.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |