public abstract class Machine
extends java.lang.Object
| Constructor and Description |
|---|
Machine(java.util.Map<java.lang.String,Task> tasks)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
State |
getState()
Returns current state.
|
protected abstract boolean |
isAllowed(Transition transition)
Checks if given
transition is allowed. |
boolean |
isFinished()
Returns
finished flag value. |
protected abstract boolean |
isFinishing(Transition transition)
Checks if given
transition is an finishing condition. |
boolean |
isStarted()
Returns
started flag value. |
protected abstract boolean |
isStarting(Transition transition)
Checks if given
transition is a starting condition. |
protected void |
perform(TransitionContext context,
Task... tasks)
Performs each of given
tasks with specified
context. |
void |
setState(State state)
Sets state.
|
public Machine(java.util.Map<java.lang.String,Task> tasks)
tasks - taskspublic final State getState()
public final void setState(State state) throws FSMException
state - new stateFSMException - if an error occurs.protected void perform(TransitionContext context, Task... tasks) throws FSMException
tasks with specified
context. Each task can be performed concurrently. This
method must guarantee that all tasks are performed before return.context - transition contexttasks - tasksFSMException - if an error occurs.public final boolean isStarted()
started flag value.public final boolean isFinished()
finished flag value.protected abstract boolean isStarting(Transition transition)
transition is a starting condition.
Default implementation always returns true. Override this
method if customizations are needed.transition - transition to checkprotected abstract boolean isAllowed(Transition transition)
transition is allowed. Default
implementation always returns true. Override this method if
customizations are needed.transition - transition to check.protected abstract boolean isFinishing(Transition transition)
transition is an finishing condition.
Default implementation always returns false. Override this
method if customizations are needed.transition - transition to checkCopyright © 2011. All Rights Reserved.