|
|||||||||||
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.DisjointSet
A set which is disjoint from others s. Two sets are disjoint (or mutually exclusive
DisjointSet set0 = new DisjointSet(true); // Used as the trash set. DisjointSet set1 = new DisjointSet(set0); DisjointSet set2 = new DisjointSet(set0);Disjoint sets are thread-safe.
Constructor Summary | |
DisjointSet()
Construct a initially empty set. |
|
DisjointSet(boolean hasTrash)
Construct a initially empty set with an optional trash set. |
|
DisjointSet(DisjointSet disjointSet)
Construct a new set mutually exclusive with the specified set. |
Method Summary | |
boolean |
add(java.lang.Object element)
Ensures that this collection contains the specified element. |
boolean |
addAll(java.util.Collection c)
Adds all of the elements in the specified collection to this set. |
void |
clear()
Removes all of the elements from this set. |
boolean |
contains(java.lang.Object element)
Returns if this set contains the specified element. |
boolean |
containsAll(java.util.Collection c)
Returns if this set contains all of the elements in the specified collection. |
boolean |
equals(java.lang.Object set)
Compare this set with the specified object for equality. |
java.util.Set |
getTrash()
Returns the trash set, or if there is none. |
int |
hashCode()
Returns an hash value for this set. |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this collection. |
boolean |
remove(java.lang.Object element)
Removes a single instance of the specified element from this set, if it is present. |
boolean |
removeAll(java.util.Collection c)
Removes from this set all of its elements that are contained in the specified collection. |
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this set that are contained in the specified collection. |
int |
size()
Returns the number of elements in this set. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns an array containing all of the elements in this collection. |
java.lang.String |
toString()
Returns a string representation of this set. |
Methods inherited from class java.util.AbstractCollection |
isEmpty |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
isEmpty |
Constructor Detail |
public DisjointSet()
s constructed using this constructor has no trash.
All remove operations on this set really remove all references to the
removed element, like a usual Set
. This is opposed to moving the
element to a "trash" set, which is allowed by the
constructor.
public DisjointSet(boolean hasTrash)
hasTrash
- If , all remove operations
will add removed elements to a trash set (thus, really just moving the
element to the trash). If , there is no trash and this
constructor behave like the no-argument constructor.getTrash()
public DisjointSet(DisjointSet disjointSet)
disjointSet
- The set to be disjoint from.Method Detail |
public java.util.Set getTrash()
public int size()
size
in interface java.util.Set
public boolean contains(java.lang.Object element)
contains
in interface java.util.Set
element
- Object to be checked for containment in this set.
public boolean add(java.lang.Object element)
add
in interface java.util.Set
element
- Element whose presence in this set is to be ensured.
public boolean remove(java.lang.Object element)
remove
in interface java.util.Set
element
- Element to be removed from this set.
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Set
c
- collection to be checked for containment in this collection.
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Set
c
- collection whose elements are to be added to this set.
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Set
c
- elements to be removed from this set.
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Set
c
- elements to be retained in this collection.
public void clear()
clear
in interface java.util.Set
public java.util.Iterator iterator()
iterator
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Set
a
- The array into which the elements of the set are to be
stored, if it is big enough; otherwise, a new array of
the same runtime type is allocated for this purpose.
public java.lang.String toString()
public int hashCode()
hashCode
in interface java.util.Set
public boolean equals(java.lang.Object set)
equals
in interface java.util.Set
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |