|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractSet org.geotools.util.DerivedSet
A set whose values are derived from an other set. The values are derived only when
requested, which make it possible to backup potentially large sets. Implementations
need only to overrides baseToDerived(java.lang.Object)
and derivedToBase(java.lang.Object)
methods.
This set do not supports value, since is used
when no mapping from base to exists.
This class is serializable if the underlying base set is serializable
too.
Field Summary | |
protected java.util.Set |
base
The base set whose values are derived from. |
Constructor Summary | |
DerivedSet(java.util.Set base)
Creates a new derived set from the specified base set. |
Method Summary | |
boolean |
add(java.lang.Object element)
Ensures that this set contains the specified element. |
protected abstract java.lang.Object |
baseToDerived(java.lang.Object element)
Transforms a value in the base set to a value in this set. |
boolean |
contains(java.lang.Object element)
Returns if this set contains the specified element. |
protected abstract java.lang.Object |
derivedToBase(java.lang.Object element)
Transforms a value in this set to a value in the base set. |
boolean |
isEmpty()
Returns if this set contains no elements. |
java.util.Iterator |
iterator()
Returns an iterator over the elements contained in this set. |
boolean |
remove(java.lang.Object element)
Removes a single instance of the specified element from this set. |
int |
size()
Returns the number of elements in this set. |
Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
addAll, clear, containsAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, clear, containsAll, retainAll, toArray, toArray |
Field Detail |
protected final java.util.Set base
baseToDerived(java.lang.Object)
,
derivedToBase(java.lang.Object)
Constructor Detail |
public DerivedSet(java.util.Set base)
base
- The base set.Method Detail |
protected abstract java.lang.Object baseToDerived(java.lang.Object element)
element
- A value in the base set.
protected abstract java.lang.Object derivedToBase(java.lang.Object element)
element
- A value in this set.
public java.util.Iterator iterator()
baseToDerived(java.lang.Object)
for each element.
iterator
in interface java.util.Set
public int size()
iterator
.
size
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Set
public boolean contains(java.lang.Object element)
base.contains(derivedToBase(element))
.
contains
in interface java.util.Set
element
- object to be checked for containment in this set.
public boolean add(java.lang.Object element) throws java.lang.UnsupportedOperationException
base.add(derivedToBase(element))
.
add
in interface java.util.Set
element
- element whose presence in this set is to be ensured.
java.lang.UnsupportedOperationException
- if the base set doesn't
supports the operation.public boolean remove(java.lang.Object element) throws java.lang.UnsupportedOperationException
base.remove(derivedToBase(element))
.
remove
in interface java.util.Set
element
- element to be removed from this set, if present.
java.lang.UnsupportedOperationException
- if the base set doesn't
supports the operation.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |