|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectElement
This class is used for implementing and manipulating a tree representation of
a generic set, which allows for efficient union and find-set operations. See
the comment for the Set class for more information on the structure of a set.
Each Element instance is a node in the tree set representation. It stores the
value of the element; if it is not the root of the tree
then it has a reference to its parent Element in the tree,
if it is the root of the tree (i.e., it is the set representative)
then it has a reference to the Set instance of the set for the tree.
The Element class also implements a findSet() method that
returns a reference to the Set instance of the set that contains this Element.
Field Summary | |
static boolean |
usePathCompression
This parameter specifies whether path compression is applied whenever a find-set operation is performed. |
Constructor Summary | |
Element(java.lang.Object v)
This is the constructor method for Element class. |
Method Summary | |
Set |
findSet()
This method returns a reference to the Set instance of the set that contains this Element. |
java.lang.Object |
getParentElmnt()
This method returns the parent of the Element. |
java.lang.Object |
getValue()
This method returns the value of the Element. |
void |
setParentElmnt(Element newParent)
This method sets the parent of the Element. |
java.lang.String |
toString()
Overwrite default toString() method to print Element info. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static boolean usePathCompression
Constructor Detail |
public Element(java.lang.Object v)
v
- the Element's valueMethod Detail |
public java.lang.String toString()
public java.lang.Object getValue()
public java.lang.Object getParentElmnt()
public void setParentElmnt(Element newParent)
newParent
- the new parent Object.public Set findSet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |