public class State extends 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.
States inherits Transitions from
their parent. A State can override any of the parents
Transitions. When an Event is processed the Transitions
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 and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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. |
List<SelfTransition> |
getOnEntrySelfTransitions()
Returns an unmodifiable
List of entry SelfTransitions |
List<SelfTransition> |
getOnExitSelfTransitions()
Returns an unmodifiable
List of exit SelfTransitions |
State |
getParent()
Returns the parent
State. |
List<Transition> |
getTransitions()
|
int |
hashCode() |
String |
toString() |
public State(String id)
State with the specified id.id - the unique id of this State.public State getParent()
State.null if this State has no
parent.public List<Transition> getTransitions()
Transitions.public List<SelfTransition> getOnEntrySelfTransitions()
List of entry SelfTransitionsSelfTransitions.public List<SelfTransition> getOnExitSelfTransitions()
List of exit SelfTransitionsSelfTransitions.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 Transitions match the same
Event the Transition with the lower weight will
be executed.transition - the Transition to add.State.Copyright © 2004–2017 Apache MINA Project. All rights reserved.