Class State
java.lang.Object
org.apache.mina.statemachine.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.
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe state IDprivate List<SelfTransition> The list of entry transitions on a stateprivate List<SelfTransition> The list of exit transition from a stateprivate final StateThe parent stateprivate List<State.TransitionHolder> private List<Transition> The list of transitions for this state -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) StateaddOnEntrySelfTransaction(SelfTransition onEntrySelfTransaction) Adds an entrySelfTransitionto thisState(package private) StateaddOnExitSelfTransaction(SelfTransition onExitSelfTransaction) Adds an exitSelfTransitionto thisStateaddTransition(Transition transition) Adds an outgoingTransitionto thisStatewith weight 0.addTransition(Transition transition, int weight) Adds an outgoingTransitionto thisStatewith the specified weight.booleangetId()inthashCode()toString()private void
-
Field Details
-
id
The state ID -
parent
The parent state -
transitionHolders
-
transitions
The list of transitions for this state -
onEntries
The list of entry transitions on a state -
onExits
The list of exit transition from a state
-
-
Constructor Details
-
State
-
State
-
-
Method Details
-
getId
-
getParent
-
getTransitions
- Returns:
- an unmodifiable
ListofTransitions going out from thisState.
-
getOnEntrySelfTransitions
- Returns:
- an unmodifiable
Listof entrySelfTransitions
-
getOnExitSelfTransitions
- Returns:
- an unmodifiable
Listof exitSelfTransitions
-
addOnEntrySelfTransaction
Adds an entrySelfTransitionto thisState- Parameters:
selfTransition- theSelfTransitionto add.- Returns:
- this
State.
-
addOnExitSelfTransaction
Adds an exitSelfTransitionto thisState- Parameters:
selfTransition- theSelfTransitionto add.- Returns:
- this
State.
-
updateTransitions
private void updateTransitions() -
addTransition
Adds an outgoingTransitionto thisStatewith weight 0.- Parameters:
transition- theTransitionto add.- Returns:
- this
State. - See Also:
-
addTransition
Adds an outgoingTransitionto thisStatewith the specified weight. The higher the weight the less important aTransitionis. If twoTransitions match the sameEventtheTransitionwith the lower weight will be executed.- Parameters:
transition- theTransitionto add.weight- The weight of this transition- Returns:
- this
State.
-
equals
-
hashCode
-
toString
-