Class AbstractTransition
- java.lang.Object
-
- org.apache.mina.statemachine.transition.AbstractTransition
-
- All Implemented Interfaces:
Transition
- Direct Known Subclasses:
MethodTransition,NoopTransition
public abstract class AbstractTransition extends java.lang.Object implements Transition
AbstractTransitionimplementation. Takes care of matching the currentEvent's id against the id of theEventthisTransitionhandles. To handle anyEventthe id should be set toEvent.WILDCARD_EVENT_ID.
-
-
Constructor Summary
Constructors Constructor Description AbstractTransition()AbstractTransition(java.lang.Object eventId)AbstractTransition(java.lang.Object eventId, State nextState)AbstractTransition(State nextState)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleandoExecute(Event event)Executes thisTransition.booleanequals(java.lang.Object o)booleanexecute(Event event)Executes thisTransition.StategetNextState()inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
eventId
private final java.lang.Object eventId
The accepted event ID
-
nextState
private final State nextState
The next state, if any
-
-
Constructor Detail
-
AbstractTransition
public AbstractTransition(java.lang.Object eventId)
- Parameters:
eventId- theEventid.
-
AbstractTransition
public AbstractTransition(java.lang.Object eventId, State nextState)
-
AbstractTransition
public AbstractTransition(State nextState)
- Parameters:
nextState- the nextState.
-
AbstractTransition
public AbstractTransition()
-
-
Method Detail
-
getNextState
public State getNextState()
- Specified by:
getNextStatein interfaceTransition- Returns:
- the
Statewhich theStateMachineshould move to if thisTransitionis taken andTransition.execute(Event)returnstrue.nullif thisTransitionis a loopbackTransition.
-
execute
public boolean execute(Event event)
Executes thisTransition. It is the responsibility of thisTransitionto determine whether it actually applies for the specifiedEvent. If thisTransitiondoesn't apply nothing should be executed andfalsemust be returned. The method will accept anyEventif it is registered with the wild card event ID ('*'), and the event ID it is declared for (ie, the event ID that has been passed as a parameter to this transition constructor.)- Specified by:
executein interfaceTransition- Parameters:
event- the currentEvent.- Returns:
trueif theTransitionwas executed,falseotherwise.
-
doExecute
protected abstract boolean doExecute(Event event)
Executes thisTransition. This method doesn't have to check if theEvent's id matches becauseexecute(Event)has already made sure that that is the case.- Parameters:
event- the currentEvent.- Returns:
trueif theTransitionhas been executed successfully and theStateMachineshould move to the nextState.falseotherwise.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-