|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--gumbo.util.state.AbstractStateSet
A full implementation of the StateSet interface. Uses the decorator pattern to optionally wrap a target set.
| Constructor Summary | |
AbstractStateSet()
Creates an instance, with an empty HashSet and no state policy. |
|
AbstractStateSet(java.util.Collection init)
Creates an instance, with an initialized HashSet and no state policy. |
|
AbstractStateSet(java.util.Collection init,
StatePolicy policy)
Creates an instance, with an initialized HashSet, as allowed by the policy, and a state policy. |
|
AbstractStateSet(java.util.Collection init,
StatePolicy policy,
java.util.Set target)
Creates an instance, with an external target set and a state policy. |
|
| Method Summary | |
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
change(java.lang.Object remove,
java.lang.Object add)
Removes then adds the specified state flags, as allowed by the state policy. |
boolean |
change(StateSet changes)
Performs a "masked change" by imposing a target's state set changes (deltas) on this state set, as allowed by the state policy, with the union of the target's old and new states acting as the mask. |
boolean |
changeAll(java.util.Collection remove,
java.util.Collection add)
Removes then adds the specified state flags, as allowed by the state policy. |
void |
clear()
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
equals(java.lang.Object obj)
|
java.util.Set |
getOldState()
Gets a singleton immutable view of this set's old state value, which was the state value prior to the last transit, or the same state value as the current one after a reset. |
StatePolicy |
getStatePolicy()
Gets the state policy for this state set, which assures that the state value contains valid combinations and types of state flags following state initialization and transition. |
StateSet |
getStateSet()
Gets a singleton immutable view of this set, which is the current state value, resulting from the last reset or transit. |
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
Returns an immutable iterator. |
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
reset(java.util.Collection state)
Resets (re-initializes) this state set's value to a new state, as allowed by the state policy. |
boolean |
retainAll(java.util.Collection c)
|
boolean |
set(java.util.Collection state)
Sets this state set's value to a new state, as allowed by the state policy. |
int |
size()
|
protected void |
stateReset()
Called by the system after this state value is reset, even if the value did not change. |
protected void |
stateTransit()
Called by the system after this state value is transited, even if the value did not change. |
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
boolean |
transit(java.util.Collection input)
Causes this state set's value to transit from one state to another (possibly with no change in value) according to an input value. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AbstractStateSet()
public AbstractStateSet(java.util.Collection init)
init - Initial state value. None if null.
public AbstractStateSet(java.util.Collection init,
StatePolicy policy)
init - Initial state value. None if null.policy - The state policy for this state set. None if null.
public AbstractStateSet(java.util.Collection init,
StatePolicy policy,
java.util.Set target)
init - Initial state value. None if null.policy - The state policy for this state set. None if null.target - The target of this wrapper. If null, defaults to
an internal HashSet.| Method Detail |
protected void stateReset()
protected void stateTransit()
public StatePolicy getStatePolicy()
StateSet
getStatePolicy in interface StateSetpublic boolean reset(java.util.Collection state)
StateSet
reset in interface StateSetstate - The new state value (Object). Never null.
public boolean set(java.util.Collection state)
StateSet
set in interface StateSetstate - The new state value (Object). Never null.
public boolean change(StateSet changes)
StateSet
change in interface StateSetchanges - The state value changes. Never null.
public boolean change(java.lang.Object remove,
java.lang.Object add)
StateSet
change in interface StateSetremove - Flag to be removed. None if null.add - Flag to be added. None if null.
public boolean changeAll(java.util.Collection remove,
java.util.Collection add)
StateSet
changeAll in interface StateSetremove - Flags to be removed. Never null.add - Flags to be added. Never null.
public boolean transit(java.util.Collection input)
StateSet
transit in interface StateSetinput - The input value (Object). Never null.
public java.util.Set getOldState()
StateSet
getOldState in interface StateSetpublic StateSet getStateSet()
StateSet
getStateSet in interface StateSetpublic boolean add(java.lang.Object o)
add in interface java.util.Setpublic boolean remove(java.lang.Object o)
remove in interface java.util.Setpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.Setpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Setpublic void clear()
clear in interface java.util.Setpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Setpublic java.util.Iterator iterator()
iterator in interface java.util.Setpublic int size()
size in interface java.util.Setpublic boolean contains(java.lang.Object o)
contains in interface java.util.Setpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Setpublic boolean isEmpty()
isEmpty in interface java.util.Setpublic java.lang.Object[] toArray()
toArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.Setpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Setequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.SethashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||