|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.util.state.AbstractStatePolicy
Abstract base class for implementing state assurance policies, which only involve flag type and state value checking. Can also be used for state transition policies, involving an input value, but there is no direct support (have to override StatePolicy interface methods).
Constructor Summary | |
AbstractStatePolicy()
Creates an instance. |
Method Summary | |
void |
checkInitialState(java.util.Set newState,
java.util.Set oldState)
The default implementation calls checkNewFlags(), then checkNewState(), with the new state value. |
protected abstract void |
checkNewFlags(java.util.Collection flags)
Called by this policy to check new state value flag types. |
protected abstract void |
checkNewState(java.util.Set state)
Called by this policy to check new state values (flag combinations). |
void |
checkTransitState(java.util.Collection input,
java.util.Set newState,
java.util.Set oldState)
The default implementation calls checkNewFlags(), then checkNewState(), with the new state value. |
boolean |
isCompatible(StatePolicy policy)
The default implementation always returns false. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractStatePolicy()
Method Detail |
protected abstract void checkNewFlags(java.util.Collection flags)
protected abstract void checkNewState(java.util.Set state)
state
- Reference to the new state (Object).
Never null.public boolean isCompatible(StatePolicy policy)
isCompatible
in interface StatePolicy
policy
- Other state policy. None if null.
public void checkInitialState(java.util.Set newState, java.util.Set oldState)
checkInitialState
in interface StatePolicy
newState
- Reference to the new target state value (Object).
Never null. Contains the initial state value and, upon return,
the modified initial value. Must be mutable and must NOT loop
back to this method.oldState
- The old state value (Object). Never null.public void checkTransitState(java.util.Collection input, java.util.Set newState, java.util.Set oldState)
checkTransitState
in interface StatePolicy
input
- Input value (Object). None if null (such as in a
"set state" operation), which may be distinct from an empty value.
If the same reference as state, may cause concurrent modification
exceptions.newState
- Reference to the new target state value (Object).
Contains the new state value and, upon return, the modified new value.
Never null. Must be mutable and must NOT loop back to this method.oldState
- The old state value (Object). Never null.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |