|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.amattioli.workstate.core.State
public abstract class State
Represent a generic state. Each state is associated to a MetaState
that represents its configuration. After creation a state is not active and
only the enter() method can be called on it. This method activate
the state and initialize it. Calling exit() the state will be exited
and it will be no more active. At creation time a unuique id will be created
for the state.
| Constructor Summary | |
|---|---|
State(MetaState metastate,
CompositeState parent)
|
|
| Method Summary | |
|---|---|
void |
addAvailableEvents(Collection<MetaEvent> coll)
|
abstract boolean |
admitEvent(Event event)
|
Event |
buildEvent(String name,
Map<String,Object> stringParameters)
|
protected void |
checkActive()
Verifies if this state is active. |
void |
enter()
Enter this state and activate it. |
boolean |
equals(Object o)
|
void |
exit()
Exit a state and de-activate it. |
CompositeState |
findAncestor(MetaState ancestorMetaState)
Search for an ancestor of this state whose MetaState is given. |
Map<String,Object> |
getAllAttributes()
Return all the attributes of this state. |
Object |
getAttribute(String tag)
Return the value of an attribute of this state. |
Collection<MetaEvent> |
getAvailableEvents()
|
String |
getId()
Return the identifier of this state. |
StateMemento |
getMemento()
|
protected abstract StateMemento |
getMemento(StateMemento parent)
|
CompositeState |
getParent()
Return the composite state that is parent of this state. |
Machine |
getRootMachine()
|
boolean |
hasMetaState(MetaState metastate)
Check if the given MetaState is this state meta-state. |
boolean |
isActive()
Verifies if this state is active. |
boolean |
isRegion()
Check if this state is a region of a ConcurrentState. |
abstract void |
receiveEvent(Event event)
|
protected void |
reEnter()
Re-enter a state that was exited for exception handling purposes. |
protected void |
reExit()
Re-exit a state that was entered for exception handling purposes. |
abstract void |
restore(StateMemento memento)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public State(MetaState metastate,
CompositeState parent)
| Method Detail |
|---|
public void enter()
throws WorkflowException
IllegalStateException - if this state is already
WorkflowExceptionprotected void reEnter()
public void exit()
throws WorkflowException
IllegalStateException - if the state is not active
WorkflowExceptionprotected void reExit()
public CompositeState getParent()
public CompositeState findAncestor(MetaState ancestorMetaState)
MetaState is given.
IllegalArgumentException - if no ancestor of this has the given MetaStatepublic boolean isActive()
protected void checkActive()
IllegalStateException - if this state is not activepublic boolean hasMetaState(MetaState metastate)
MetaState is this state meta-state.
metastate - the MetaState to be checked
MetaState is this state meta-state,
false otherwisepublic Machine getRootMachine()
public abstract void receiveEvent(Event event)
throws WorkflowException
WorkflowExceptionpublic abstract boolean admitEvent(Event event)
public Object getAttribute(String tag)
getAttribute in interface AttributeReadertag - the attribute tag
IllegalStateException - if the state is not active
IllegalArgumentException - if there is no attribute with the given namepublic Map<String,Object> getAllAttributes()
getAllAttributes in interface AttributeReaderpublic String getId()
protected abstract StateMemento getMemento(StateMemento parent)
public StateMemento getMemento()
public abstract void restore(StateMemento memento)
throws WorkflowException
WorkflowExceptionpublic boolean equals(Object o)
equals in class Objectpublic boolean isRegion()
ConcurrentState. Only
SequentialStates can be regions so the default implementation of
this method return false.
ConcurrentState,
false otherwise
public Event buildEvent(String name,
Map<String,Object> stringParameters)
throws WorkflowException
WorkflowExceptionpublic void addAvailableEvents(Collection<MetaEvent> coll)
public Collection<MetaEvent> getAvailableEvents()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||