Package com.alibaba.cola.statemachine
Interface Transition<S,E,C>
-
- Type Parameters:
S- the type of stateE- the type of eventC- the type of user defined context, which is used to hold application data
- All Known Implementing Classes:
TransitionImpl
public interface Transition<S,E,C>Transitionis something what a state machine associates with a state changes.- Author:
- Frank Zhang
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Action<S,E,C>getAction()Condition<C>getCondition()Gets the guard of this transition.EgetEvent()State<S,E,C>getSource()Gets the source state of this transition.State<S,E,C>getTarget()Gets the target state of this transition.voidsetAction(Action<S,E,C> action)voidsetCondition(Condition<C> condition)voidsetEvent(E event)voidsetSource(State<S,E,C> state)voidsetTarget(State<S,E,C> state)voidsetType(TransitionType type)State<S,E,C>transit(C ctx, boolean checkCondition)Do transition from source state to target state.voidverify()Verify transition correctness
-
-
-
Method Detail
-
getSource
State<S,E,C> getSource()
Gets the source state of this transition.- Returns:
- the source state
-
getEvent
E getEvent()
-
setEvent
void setEvent(E event)
-
setType
void setType(TransitionType type)
-
getTarget
State<S,E,C> getTarget()
Gets the target state of this transition.- Returns:
- the target state
-
transit
State<S,E,C> transit(C ctx, boolean checkCondition)
Do transition from source state to target state.- Returns:
- the target state
-
verify
void verify()
Verify transition correctness
-
-