|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpqrtree.Node
public class Node
A node
object can be
of four types: P, Q, R - represented
by the PQRNode
class - or leaves -
represented by the Leaf
class.
PQRNode
,
Leaf
Field Summary | |
---|---|
protected PQRNode |
ancestor
|
protected ListNode |
ancestorListPosition
|
protected Node |
ancestorReference
|
private int |
color
|
protected static int |
COLOR_BLACK
|
protected static int |
COLOR_GRAY
|
protected static int |
COLOR_WHITE
|
protected boolean |
leaf
|
protected static int |
TYPE_PNODE
|
protected static int |
TYPE_QNODE
|
protected static int |
TYPE_RNODE
|
private boolean |
visited
|
Constructor Summary | |
---|---|
Node(PQRNode ancestor)
Creates a new PQRTree's node, linked to it's ancestor |
Method Summary | |
---|---|
Node |
findLeader()
Finds the representative of the disjoint set, implementing the shrink path heuristics |
PQRNode |
getAncestor()
Gets the ancestor direct link, if it exists. |
ListNode |
getAncestorListPosition()
Gets the node of the children list of the parent that points to the node. |
Node |
getAncestorReference()
Gets the ancestor reference link, if it exists. |
int |
getColor()
Returns the color of the node. |
PQRNode |
getParent()
Finds the imediate ancestor of the node. |
boolean |
isLeaf()
Verifies if the node is a leaf. |
void |
setAncestor(PQRNode ancestor)
Sets the ancestor direct link. |
void |
setAncestorListPosition(ListNode n)
Sets the node of the children list of the parent that points to the node. |
void |
setAncestorReference(Node n)
Sets the ancestor direct link. |
void |
setColor(int color)
Sets the color of the node. |
void |
setParent(PQRNode p)
Sets ancestor direct link and ancestor reference to make possible finding the parent. |
Node |
union(Node v,
int sizeV,
Node p,
int sizeP)
Join two node children of the same node. |
void |
visited(boolean visited)
Sets the visited state of the node. |
boolean |
wasVisited()
Verifies if the node was already visited. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean visited
private int color
protected boolean leaf
protected ListNode ancestorListPosition
protected PQRNode ancestor
protected Node ancestorReference
protected static final int TYPE_PNODE
protected static final int TYPE_QNODE
protected static final int TYPE_RNODE
protected static final int COLOR_WHITE
protected static final int COLOR_GRAY
protected static final int COLOR_BLACK
Constructor Detail |
---|
public Node(PQRNode ancestor)
ancestor
- The internal node from which the new node descendMethod Detail |
---|
public boolean wasVisited()
true
, if the node was
visited, or false
, if it wasn't.public void visited(boolean visited)
visited
- Reports if the node was visited.public PQRNode getAncestor()
public void setAncestor(PQRNode ancestor)
ancestor
- The ancestor, if it's a P node, or null.public Node getAncestorReference()
public void setAncestorReference(Node n)
n
- The ancestor reference. Must
be a brother, itself, or null.public PQRNode getParent()
getAncestor()
,
getAncestorReference()
public void setParent(PQRNode p)
p
- The parent.setAncestor(PQRNode)
,
setAncestorReference(Node)
public int getColor()
public void setColor(int color)
color
- Color black, gray or white.public boolean isLeaf()
true
, if the node is a
leaf, or false
, if it isn't.public ListNode getAncestorListPosition()
public void setAncestorListPosition(ListNode n)
n
- The list node.public Node findLeader()
public Node union(Node v, int sizeV, Node p, int sizeP)
v
- One nodesizeV
- Weight of the first nodep
- Another nodesizeP
- Weight of the second node
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |