public class CompositeSet<E> extends CompositeCollection<E> implements Set<E>
Changes made to this set will actually be made on the decorated set. Add operations require the use of a pluggable strategy. If no strategy is provided then add is unsupported.
| Modifier and Type | Class and Description |
|---|---|
static interface |
CompositeSet.SetMutator<E>
Define callbacks for mutation operations.
|
CompositeCollection.CollectionMutator<E>all, mutator| Constructor and Description |
|---|
CompositeSet()
Create an empty CompositeSet
|
CompositeSet(Set<E>... sets)
Create a composite set with sets as the initial set of composited Sets.
|
CompositeSet(Set<E> set)
Create a CompositeSet with just
set composited. |
| Modifier and Type | Method and Description |
|---|---|
void |
addComposited(Collection<E> c)
Add a Set to this composite
|
void |
addComposited(Collection<E>[] comps)
Add an array of sets to this composite
|
void |
addComposited(Collection<E> c,
Collection<E> d)
Add two sets to this composite.
|
boolean |
equals(Object obj) |
List<? extends Set<E>> |
getCollections()
Gets the collections being decorated.
|
protected CompositeSet.SetMutator<E> |
getMutator()
Get the collection mutator to be used for this CompositeCollection.
|
int |
hashCode() |
boolean |
remove(Object obj)
If a
CollectionMutator is defined for this CompositeSet then this
method will be called anyway. |
void |
setMutator(CompositeCollection.CollectionMutator<E> mutator)
This can receive either a
CollectionMutator
or a CompositeSet.SetMutator. |
add, addAll, clear, contains, containsAll, isEmpty, iterator, removeAll, removeComposited, retainAll, size, toArray, toArray, toCollectionpublic CompositeSet()
public CompositeSet(Set<E> set)
set composited.set - the initial set in the compositepublic CompositeSet(Set<E>... sets)
sets - the initial sets in the compositepublic void addComposited(Collection<E> c)
addComposited in class CompositeCollection<E>c - Must implement SetIllegalArgumentException - if c does not implement java.util.Set
or if a SetMutator is set, but fails to resolve a collisionUnsupportedOperationException - if there is no SetMutator set, or
a CollectionMutator is set instead of a SetMutatorCompositeCollection.CollectionMutator,
CompositeSet.SetMutatorpublic List<? extends Set<E>> getCollections()
CompositeCollectiongetCollections in class CompositeCollection<E>public void addComposited(Collection<E> c, Collection<E> d)
addComposited in class CompositeCollection<E>c - the first Set to add to this composited - the second Set to add to this compositeIllegalArgumentException - if c or d does not implement Setpublic void addComposited(Collection<E>[] comps)
addComposited in class CompositeCollection<E>comps - the Collection of Sets to add to this compositeIllegalArgumentException - if any of the collections in comps does not implement Setpublic void setMutator(CompositeCollection.CollectionMutator<E> mutator)
CollectionMutator
or a CompositeSet.SetMutator.
If a CollectionMutator
is used than conflicts when adding composited sets will throw IllegalArgumentException.setMutator in class CompositeCollection<E>mutator - the CollectionMutator
to use for this compositepublic boolean remove(Object obj)
CollectionMutator is defined for this CompositeSet then this
method will be called anyway.remove in interface Collection<E>remove in interface Set<E>remove in class CompositeCollection<E>obj - object to be removedpublic boolean equals(Object obj)
equals in interface Collection<E>equals in interface Set<E>equals in class ObjectSet.equals(java.lang.Object)public int hashCode()
hashCode in interface Collection<E>hashCode in interface Set<E>hashCode in class ObjectSet.hashCode()protected CompositeSet.SetMutator<E> getMutator()
CompositeCollectiongetMutator in class CompositeCollection<E>Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.