public abstract class AbstractTransitionModel<S,E,C> extends java.lang.Object implements TransitionModel<S,E,C>
| Modifier and Type | Field and Description |
|---|---|
protected C |
defaultContext |
protected java.util.Map<S,java.util.Collection<Action<S,E,C>>> |
enterActions |
protected java.lang.Class<E> |
eventClass |
protected java.util.Map<S,java.util.Collection<Action<S,E,C>>> |
exitActions |
protected java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>> |
fromAllTransitions |
protected java.lang.Class<S> |
stateClass |
protected java.util.Map<S,java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>>> |
transitionMap |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTransitionModel(java.lang.Class<S> stateClass,
java.lang.Class<E> eventClass,
C defaultContext) |
| Modifier and Type | Method and Description |
|---|---|
protected static <S,T> java.util.Map<S,T> |
createMap(java.lang.Class<S> state) |
boolean |
fireEvent(StateMachine<S,E,C> stateMachine,
E event,
C context)
Fires the event at the state machine.
|
boolean |
forceSetState(StateMachine<S,E,C> stateMachine,
S forcedState)
Forces the state machine to enter the forcedState even if there are no transitions to that state.
|
C |
getDefaultContext() |
java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>> |
getFromAllTransitions() |
java.util.Map<E,java.util.Collection<? extends Transition<S,C>>> |
getPossibleTransitions(S fromState) |
java.util.Map<S,java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>>> |
getStateTransitions() |
protected final java.util.Map<S,java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>>> transitionMap
protected final java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>> fromAllTransitions
protected final java.lang.Class<S> stateClass
protected final java.lang.Class<E> eventClass
protected final C defaultContext
protected static <S,T> java.util.Map<S,T> createMap(java.lang.Class<S> state)
public boolean fireEvent(StateMachine<S,E,C> stateMachine, E event, C context)
TransitionModelfireEvent in interface TransitionModel<S,E,C>stateMachine - the machine to fire the event atevent - the event to firecontext - the context to use for transition conditions and actions. The context can be used to
supply arguments to actions.public boolean forceSetState(StateMachine<S,E,C> stateMachine, S forcedState)
TransitionModelforceSetState in interface TransitionModel<S,E,C>stateMachine - the state machine to force the state forforcedState - the state the machine will be in after this methodpublic java.util.Map<S,java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>>> getStateTransitions()
public java.util.Map<E,java.util.Collection<BasicTransition<S,E,C>>> getFromAllTransitions()
public C getDefaultContext()
getDefaultContext in interface TransitionModel<S,E,C>public java.util.Map<E,java.util.Collection<? extends Transition<S,C>>> getPossibleTransitions(S fromState)
getPossibleTransitions in interface TransitionModel<S,E,C>