|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--agl2.util.UnionFind
The UnionFind
Discjoint Set code with some set interfaces
Constructor Summary | |
UnionFind()
Creates a DisjointSet . |
Method Summary | |
boolean |
contains(java.lang.Object o)
Determines if there is a set of more than one element containing o . |
java.lang.Object |
find(java.lang.Object o)
Returns the representative of the (unique) set containing o . |
java.util.Set |
members(java.lang.Object o)
|
boolean |
sameSet(java.lang.Object element1,
java.lang.Object element2)
|
java.lang.String |
toString()
|
void |
union(java.lang.Object o1,
java.lang.Object o2)
Unites the dynamic sets that contain o1 and
o2 , say S1 and S2, into a new set that is the
union of these two sets. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public UnionFind()
DisjointSet
.
Method Detail |
public void union(java.lang.Object o1, java.lang.Object o2)
o1
and
o2
, say S1 and S2, into a new set that is the
union of these two sets. The two sets are assumed to be
disjoint prior to the operation. The representative of the
resulting set is the representative of either S1 or S2; if
both S1 and S2 were previously singletons, the representative
of S1 union S2 is the representative of S2.
public java.lang.Object find(java.lang.Object o)
o
.
public boolean contains(java.lang.Object o)
o
.
public boolean sameSet(java.lang.Object element1, java.lang.Object element2)
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Set members(java.lang.Object o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |