|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjjil.algorithm.EquivalenceClass
public class EquivalenceClass
EquivalenceClass implements equivalence classes using the efficient union-find algorithm whose complexity grows as the inverse Ackermann's function.
The code here is based on a Wikipedia article
en.wikipedia.org/wiki/Connected_Component_Labeling
new EquivalenceClass(int nLabel) creates a new equivalence class with
the given label. Note: nLabel must be unique to calls to the constructor.
e.find() returns the equivalence class for class e.
e.union(f) unions class e and class f.
e.getLabel() returns the integer label for e.
e.getLabel() == f.getLabel() iff e and f are in the same
equivalence class.
Constructor Summary | |
---|---|
EquivalenceClass()
Create a new set |
Method Summary | |
---|---|
EquivalenceClass |
find()
Look up the equivalence class for this set. |
int |
getLabel()
Returns the unique label for this equivalence class. |
static void |
reset()
Must be called once when a new set of equivalence classes is to be defined. |
void |
union(EquivalenceClass y)
Unifies this class with another class. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EquivalenceClass()
Method Detail |
---|
public EquivalenceClass find()
public int getLabel()
public static void reset()
public void union(EquivalenceClass y)
y
- the class to unify with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |