|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--gumbo.util.AbstractGroup
An abstract implementation of the Group interface. Intended as a lightweight proxy for a group's store, with lazy build of the store and this object's immutable views. Uses the decorator pattern to wrap an external target store or, if none, uses lazy build for an internal one.
Although collections have become efficient as regards memory and new object usage, this class goes farther by acting as a proxy for the target collection itself, with the lazy build target remaining null as long as it is empty or not being viewed. As such, all accessors test for isEmpty() before creating the backing store.
| Constructor Summary | |
AbstractGroup()
Constructs an instance, with an empty lazy build store (see newGroupStore()). |
|
AbstractGroup(java.util.Collection init)
Constructs an instance, with an initialized store (see newGroupStore()). |
|
AbstractGroup(java.util.Collection init,
java.util.Collection target)
Constructs an instance, with a wrapped and initialized store. |
|
AbstractGroup(java.lang.Object[] init)
Constructs an instance, with an initialized store (see newGroupStore()). |
|
| Method Summary | |
void |
add(int index,
java.lang.Object member)
Similar to List.add(int, Object), but functionally equivalent to Collection.add(Object) if index is <0. |
boolean |
add(java.lang.Object member)
|
boolean |
addAll(java.util.Collection members)
|
void |
addAll(int index,
java.util.Collection members)
Similar to List.addAll(int, Collection), but functionally equivalent to Collection.addAll(Collection) if index is <0. |
boolean |
contains(java.lang.Object member)
|
boolean |
containsAll(java.util.Collection members)
|
boolean |
containsAny(java.util.Collection members)
Returns true if this group contains any of the specified members. |
boolean |
equals(java.lang.Object obj)
|
Group |
getGroup()
Gets an immutable view of this group. |
protected java.util.Collection |
getGroupStore()
Called by the system to access the mutable backing store. |
java.util.List |
getList()
Gets a singleton immutable view of the group store as a list, which is useful for testing equality with another list. |
java.util.Set |
getSet()
Gets a singleton immutable view of the group store as a set, which is useful for testing equality with another set. |
int |
hashCode()
|
java.util.Iterator |
iterator()
|
protected java.util.Collection |
newGroupStore()
Called by the system when it needs to lazily build the group backing store. |
boolean |
remove(java.lang.Object member)
|
boolean |
removeAll(java.util.Collection members)
|
boolean |
retainAll(java.util.Collection members)
|
int |
size()
|
java.lang.String |
toString()
|
| Methods inherited from class java.util.AbstractCollection |
clear, isEmpty, toArray, toArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
clear, isEmpty, toArray, toArray |
| Constructor Detail |
public AbstractGroup()
public AbstractGroup(java.util.Collection init)
init - The initial members (Object). None if null.public AbstractGroup(java.lang.Object[] init)
init - The initial members. Never null.
public AbstractGroup(java.util.Collection init,
java.util.Collection target)
init - The initial members (Object). None if null.target - The target group store being wrapped. If null,
defaults to the lazy build target (see newGroupStore()). If
init is non-null, any contents will be lost.| Method Detail |
protected java.util.Collection newGroupStore()
protected java.util.Collection getGroupStore()
java.lang.IllegalStateException - New group store is null.
public void add(int index,
java.lang.Object member)
Group
add in interface Groupindex - Index of the added member. If <0 the member is added
to the end of the list.member - The member to be added, which may be null.
public void addAll(int index,
java.util.Collection members)
Group
addAll in interface Groupindex - Index of the first added member. If <0 the members
are added to the end of the list.members - The members (Object) to be added, which may be null.
Never null.public boolean containsAny(java.util.Collection members)
Group
containsAny in interface Groupmembers - The members, which may be null. Never null.
public Group getGroup()
Group
getGroup in interface Grouppublic java.util.Set getSet()
Group
getSet in interface Grouppublic java.util.List getList()
Group
getList in interface Grouppublic boolean add(java.lang.Object member)
add in interface java.util.Collectionadd in class java.util.AbstractCollectionpublic boolean addAll(java.util.Collection members)
addAll in interface java.util.CollectionaddAll in class java.util.AbstractCollectionpublic boolean remove(java.lang.Object member)
remove in interface java.util.Collectionremove in class java.util.AbstractCollectionpublic boolean removeAll(java.util.Collection members)
removeAll in interface java.util.CollectionremoveAll in class java.util.AbstractCollectionpublic boolean retainAll(java.util.Collection members)
retainAll in interface java.util.CollectionretainAll in class java.util.AbstractCollectionpublic boolean contains(java.lang.Object member)
contains in interface java.util.Collectioncontains in class java.util.AbstractCollectionpublic boolean containsAll(java.util.Collection members)
containsAll in interface java.util.CollectioncontainsAll in class java.util.AbstractCollectionpublic java.util.Iterator iterator()
iterator in interface java.util.Collectioniterator in class java.util.AbstractCollectionpublic int size()
size in interface java.util.Collectionsize in class java.util.AbstractCollectionpublic java.lang.String toString()
toString in class java.util.AbstractCollectionpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Collectionequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||