S
- the type of stateE
- the type of eventpublic abstract class AbstractState<S,E> extends java.lang.Object implements State<S,E>
State
.Constructor and Description |
---|
AbstractState(S id,
java.util.Collection<E> deferred)
Instantiates a new abstract state.
|
AbstractState(S id,
java.util.Collection<E> deferred,
java.util.Collection<? extends Action<S,E>> entryActions,
java.util.Collection<? extends Action<S,E>> exitActions)
Instantiates a new abstract state.
|
AbstractState(S id,
java.util.Collection<E> deferred,
java.util.Collection<? extends Action<S,E>> entryActions,
java.util.Collection<? extends Action<S,E>> exitActions,
PseudoState<S,E> pseudoState)
Instantiates a new abstract state.
|
AbstractState(S id,
java.util.Collection<E> deferred,
java.util.Collection<? extends Action<S,E>> entryActions,
java.util.Collection<? extends Action<S,E>> exitActions,
PseudoState<S,E> pseudoState,
java.util.Collection<Region<S,E>> regions)
Instantiates a new abstract state.
|
AbstractState(S id,
java.util.Collection<E> deferred,
java.util.Collection<? extends Action<S,E>> entryActions,
java.util.Collection<? extends Action<S,E>> exitActions,
PseudoState<S,E> pseudoState,
StateMachine<S,E> submachine)
Instantiates a new abstract state.
|
AbstractState(S id,
PseudoState<S,E> pseudoState)
Instantiates a new abstract state.
|
Modifier and Type | Method and Description |
---|---|
void |
addStateListener(StateListener<S,E> listener)
Adds the state listener.
|
void |
entry(StateContext<S,E> context)
Initiate an entry sequence for the state.
|
void |
exit(StateContext<S,E> context)
Initiate an exit sequence for the state.
|
java.util.Collection<E> |
getDeferredEvents()
Gets the deferred events for this state.
|
java.util.Collection<? extends Action<S,E>> |
getEntryActions()
Gets
Action s executed entering in this state. |
java.util.Collection<? extends Action<S,E>> |
getExitActions()
Gets
Action s executed exiting from this state. |
S |
getId()
Gets the state identifier.
|
abstract java.util.Collection<S> |
getIds()
Gets the state identifiers.
|
PseudoState<S,E> |
getPseudoState()
Gets a
PseudoState attached to a State . |
java.util.Collection<Region<S,E>> |
getRegions()
Gets the regions.
|
abstract java.util.Collection<State<S,E>> |
getStates()
Gets all possible states this state knows about including itself
and substates.
|
StateMachine<S,E> |
getSubmachine()
Gets the submachine.
|
java.util.List<Trigger<S,E>> |
getTriggers() |
boolean |
isComposite()
Checks if state is a composite state.
|
boolean |
isOrthogonal()
Checks if state is an orthogonal state.
|
boolean |
isSimple()
Checks if state is a simple state.
|
boolean |
isSubmachineState()
Checks if state is a submachine state.
|
void |
removeStateListener(StateListener<S,E> listener)
Removes the state listener.
|
boolean |
sendEvent(org.springframework.messaging.Message<E> event)
Send an event
E wrapped with a Message to the state. |
void |
setTriggers(java.util.List<Trigger<S,E>> triggers) |
boolean |
shouldDefer(org.springframework.messaging.Message<E> event)
Checks if state wants to defer an event.
|
java.lang.String |
toString() |
public AbstractState(S id, PseudoState<S,E> pseudoState)
id
- the state identifierpseudoState
- the pseudo statepublic AbstractState(S id, java.util.Collection<E> deferred)
id
- the state identifierdeferred
- the deferredpublic AbstractState(S id, java.util.Collection<E> deferred, java.util.Collection<? extends Action<S,E>> entryActions, java.util.Collection<? extends Action<S,E>> exitActions)
id
- the state identifierdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspublic AbstractState(S id, java.util.Collection<E> deferred, java.util.Collection<? extends Action<S,E>> entryActions, java.util.Collection<? extends Action<S,E>> exitActions, PseudoState<S,E> pseudoState)
id
- the state identifierdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspseudoState
- the pseudo statepublic AbstractState(S id, java.util.Collection<E> deferred, java.util.Collection<? extends Action<S,E>> entryActions, java.util.Collection<? extends Action<S,E>> exitActions, PseudoState<S,E> pseudoState, StateMachine<S,E> submachine)
id
- the state identifierdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspseudoState
- the pseudo statesubmachine
- the submachinepublic AbstractState(S id, java.util.Collection<E> deferred, java.util.Collection<? extends Action<S,E>> entryActions, java.util.Collection<? extends Action<S,E>> exitActions, PseudoState<S,E> pseudoState, java.util.Collection<Region<S,E>> regions)
id
- the state identifierdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspseudoState
- the pseudo stateregions
- the regionspublic boolean sendEvent(org.springframework.messaging.Message<E> event)
State
E
wrapped with a Message
to the state.public boolean shouldDefer(org.springframework.messaging.Message<E> event)
State
shouldDefer
in interface State<S,E>
event
- the wrapped eventpublic void exit(StateContext<S,E> context)
State
public void entry(StateContext<S,E> context)
State
public abstract java.util.Collection<S> getIds()
State
public abstract java.util.Collection<State<S,E>> getStates()
State
public PseudoState<S,E> getPseudoState()
State
PseudoState
attached to a State
.
PseudoState
is not required and thus this method return
NULL
if it's not set.getPseudoState
in interface State<S,E>
public java.util.Collection<E> getDeferredEvents()
State
getDeferredEvents
in interface State<S,E>
public java.util.Collection<? extends Action<S,E>> getEntryActions()
State
Action
s executed entering in this state.getEntryActions
in interface State<S,E>
public java.util.Collection<? extends Action<S,E>> getExitActions()
State
Action
s executed exiting from this state.getExitActions
in interface State<S,E>
public boolean isComposite()
State
isComposite
in interface State<S,E>
public boolean isOrthogonal()
State
TRUE
,
State.isComposite()
will also always return TRUE
.isOrthogonal
in interface State<S,E>
public boolean isSimple()
State
public boolean isSubmachineState()
State
isSubmachineState
in interface State<S,E>
public void addStateListener(StateListener<S,E> listener)
State
addStateListener
in interface State<S,E>
listener
- the listenerpublic void removeStateListener(StateListener<S,E> listener)
State
removeStateListener
in interface State<S,E>
listener
- the listenerpublic StateMachine<S,E> getSubmachine()
public java.util.Collection<Region<S,E>> getRegions()
public java.lang.String toString()
toString
in class java.lang.Object