Package org.apache.mina.statemachine
Class State
- java.lang.Object
-
- org.apache.mina.statemachine.State
-
public class State extends Object
Represents a state in aStateMachine
. Normally you wouldn't create instances of this class directly but rather use theState
annotation to define your states and then letStateMachineFactory
create aStateMachine
for you.State
s inheritsTransition
s from their parent. AState
can override any of the parentsTransition
s. When anEvent
is processed theTransition
s of the currentState
will be searched for aTransition
which can handle the event. If none is found theState
's parent will be searched and so on.- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description State
addTransition(Transition transition)
Adds an outgoingTransition
to thisState
with weight 0.State
addTransition(Transition transition, int weight)
Adds an outgoingTransition
to thisState
with the specified weight.boolean
equals(Object o)
String
getId()
List<SelfTransition>
getOnEntrySelfTransitions()
List<SelfTransition>
getOnExitSelfTransitions()
State
getParent()
List<Transition>
getTransitions()
int
hashCode()
String
toString()
-
-
-
Method Detail
-
getTransitions
public List<Transition> getTransitions()
- Returns:
- an unmodifiable
List
ofTransition
s going out from thisState
.
-
getOnEntrySelfTransitions
public List<SelfTransition> getOnEntrySelfTransitions()
- Returns:
- an unmodifiable
List
of entrySelfTransition
s
-
getOnExitSelfTransitions
public List<SelfTransition> getOnExitSelfTransitions()
- Returns:
- an unmodifiable
List
of exitSelfTransition
s
-
addTransition
public State addTransition(Transition transition)
Adds an outgoingTransition
to thisState
with weight 0.- Parameters:
transition
- theTransition
to add.- Returns:
- this
State
. - See Also:
addTransition(Transition, int)
-
addTransition
public State addTransition(Transition transition, int weight)
Adds an outgoingTransition
to thisState
with the specified weight. The higher the weight the less important aTransition
is. If twoTransition
s match the sameEvent
theTransition
with the lower weight will be executed.- Parameters:
transition
- theTransition
to add.weight
- The weight of this transition- Returns:
- this
State
.
-
-