it.amattioli.workstate.core
Class SequentialState
java.lang.Object
it.amattioli.workstate.core.State
it.amattioli.workstate.core.RealState
it.amattioli.workstate.core.CompositeState
it.amattioli.workstate.core.SequentialState
- All Implemented Interfaces:
- AttributeHandler, AttributeReader, Receiver
- Direct Known Subclasses:
- Machine
public class SequentialState
- extends CompositeState
CURRENT_STATE_TAG
public static final String CURRENT_STATE_TAG
- See Also:
- Constant Field Values
SequentialState
public SequentialState(MetaSequentialState metaState,
CompositeState parent)
getCurrentState
public State getCurrentState()
- Return the current sub-state of this state. At each time a sequential
state is in one and only one sub-state. This method allows to know which
is this sub-state. The current sub-state makes sense only for active
states so, before entering and after entering this state the current
sub-state will be null.
- Returns:
- the current sub-state of this state
enter
public void enter()
throws WorkflowException
- Enter this state and execute the transition associated to the initial
state.
- Overrides:
enter in class RealState
- Throws:
WorkflowException
enter
public void enter(Stack<MetaState> entryStack)
throws WorkflowException
- Enter in this state and position itself in one of its sub-states. The
given stack must contain a sequence of the sub-states that must be
entered, the same as for
enterCurrent(Stack). The difference
between this method and enterCurrent(Stack) is that this method
assumes that this state is not active so enters it and activate it while
enterCurrent(Stack) assumes this state is already active.
- Throws:
WorkflowException - if an action throws an exception
exitCurrent
public void exitCurrent()
throws WorkflowException
- Throws:
WorkflowException
reEnterCurrent
public void reEnterCurrent()
throws WorkflowException
- Throws:
WorkflowException
enterCurrent
public void enterCurrent(Stack<MetaState> entryStack)
throws WorkflowException
- Change the current sub-state of this state. The given stack must contain
the list of the tags of
MetaState to enter. This method will set
as current sub-state the one whose tag is on the top of the stack and
will enter it passing the same stack after removing the top element. In
this way the sub-state will set as its sub-state the one whose tag was in
second position, and so on. Before calling this method
exitCurrent() must be called so to exit the current sub-state.
- Throws:
NullPointerException - if the parameter is null
IllegalArgumentException - if the stack is empty or contains an invalid tag
IllegalStateException - if the current sub-state is still active
WorkflowException - if an action throws an exception
restore
public void restore(StateMemento memento)
throws WorkflowException
- Overrides:
restore in class RealState
- Throws:
WorkflowException
isRegion
public boolean isRegion()
- Description copied from class:
State
- Check if this state is a region of a
ConcurrentState. Only
SequentialStates can be regions so the default implementation of
this method return false.
- Overrides:
isRegion in class State
- Returns:
- true if this state is a region of a
ConcurrentState,
false otherwise
terminate
public void terminate()
throws WorkflowException
- Overrides:
terminate in class CompositeState
- Throws:
WorkflowException
Copyright © 2011. All Rights Reserved.