Class TransitionImpl<S,E,C>
- java.lang.Object
-
- com.alibaba.cola.statemachine.impl.TransitionImpl<S,E,C>
-
- All Implemented Interfaces:
Transition<S,E,C>
public class TransitionImpl<S,E,C> extends Object implements Transition<S,E,C>
TransitionImpl。 This should be designed to be immutable, so that there is no thread-safe risk- Author:
- Frank Zhang
-
-
Constructor Summary
Constructors Constructor Description TransitionImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object anObject)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> target)voidsetType(TransitionType type)StringtoString()State<S,E,C>transit(C ctx, boolean checkCondition)Do transition from source state to target state.voidverify()Verify transition correctness
-
-
-
Method Detail
-
getSource
public State<S,E,C> getSource()
Description copied from interface:TransitionGets the source state of this transition.- Specified by:
getSourcein interfaceTransition<S,E,C>- Returns:
- the source state
-
setSource
public void setSource(State<S,E,C> state)
- Specified by:
setSourcein interfaceTransition<S,E,C>
-
setType
public void setType(TransitionType type)
- Specified by:
setTypein interfaceTransition<S,E,C>
-
getTarget
public State<S,E,C> getTarget()
Description copied from interface:TransitionGets the target state of this transition.- Specified by:
getTargetin interfaceTransition<S,E,C>- Returns:
- the target state
-
setTarget
public void setTarget(State<S,E,C> target)
- Specified by:
setTargetin interfaceTransition<S,E,C>
-
getCondition
public Condition<C> getCondition()
Description copied from interface:TransitionGets the guard of this transition.- Specified by:
getConditionin interfaceTransition<S,E,C>- Returns:
- the guard
-
setCondition
public void setCondition(Condition<C> condition)
- Specified by:
setConditionin interfaceTransition<S,E,C>
-
getAction
public Action<S,E,C> getAction()
- Specified by:
getActionin interfaceTransition<S,E,C>
-
setAction
public void setAction(Action<S,E,C> action)
- Specified by:
setActionin interfaceTransition<S,E,C>
-
transit
public State<S,E,C> transit(C ctx, boolean checkCondition)
Description copied from interface:TransitionDo transition from source state to target state.- Specified by:
transitin interfaceTransition<S,E,C>- Returns:
- the target state
-
verify
public void verify()
Description copied from interface:TransitionVerify transition correctness- Specified by:
verifyin interfaceTransition<S,E,C>
-
-