public class State
extends java.lang.Object
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.
构造器和说明 |
---|
State(java.lang.String id)
Creates a new
State with the specified id. |
State(java.lang.String id,
State parent)
Creates a new
State with the specified id and parent. |
限定符和类型 | 方法和说明 |
---|---|
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(java.lang.Object o) |
java.lang.String |
getId() |
java.util.List<SelfTransition> |
getOnEntrySelfTransitions() |
java.util.List<SelfTransition> |
getOnExitSelfTransitions() |
State |
getParent() |
java.util.List<Transition> |
getTransitions() |
int |
hashCode() |
java.lang.String |
toString() |
public State(java.lang.String id)
State
with the specified id.id
- the unique id of this State
.public java.lang.String getId()
State
.public java.util.List<Transition> getTransitions()
List
of Transition
s going out
from this State
.public java.util.List<SelfTransition> getOnEntrySelfTransitions()
List
of entry SelfTransition
spublic java.util.List<SelfTransition> getOnExitSelfTransitions()
List
of exit SelfTransition
spublic 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.weight
- The weight of this transitionState
.public boolean equals(java.lang.Object o)
equals
在类中 java.lang.Object
public int hashCode()
hashCode
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object