|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.datatypes.PQRTree.Node
public class PQRTree.Node
Represents a PQR Tree node
Constructor Summary | |
---|---|
PQRTree.Node(PQRTree.NodeType t)
Constructs a node of type t |
Method Summary | |
---|---|
void |
addBlackLeaves(int num)
Adds a number of black leaves |
void |
addChild(PQRTree.Node n)
Adds a new child |
void |
addChild(PQRTree.Node n,
int pos)
Adds a new child at a given position |
void |
allocChildren(int n)
Allocates space for a certain number of children |
PQRTree.Node |
child(int pos)
Returns the child at a position |
PQRTree.Color |
color()
Returns the color of this node |
PQRTree.Node |
colorAndGetLCA(int numS)
Colors the current node and all ancestors, returns the LCA. |
void |
debug(java.lang.Object... args)
Debugging method |
void |
dropChild(int pos)
Eliminates a child |
PQRTree.Node |
firstChild()
Returns the first child |
int |
grayChild()
Returns the index of the first gray child |
boolean |
is(PQRTree.Color t)
True if the node is of color c |
boolean |
is(PQRTree.NodeType t)
True if the node is of type t |
boolean |
isBlack()
True if the node is black |
boolean |
isGray()
True if the node is gray |
boolean |
isLeaf()
True if the node is of type LEAF |
boolean |
isP()
True if the node is of type P |
boolean |
isQ()
True if the node is of type Q |
boolean |
isR()
True if the node is of type R |
boolean |
isWhite()
True if the node is white |
PQRTree.Node |
lastChild()
Returns the last child |
void |
makeChildGrandchild(int pos,
PQRTree.Node father)
Makes the child at pos a child of father |
void |
makeChildGrandchild(int pos,
PQRTree.Node father,
int newPos)
Makes the child at pos a child of father at newPos |
void |
makeGrandchildChild(PQRTree.Node father,
int oldPos,
int newPos)
Makes the child of father at oldPos a child of this at newPos |
void |
mergeIntoLCA(int childPos)
Merges the child into the LCA, if the LCA is a Q node or an R node |
PQRTree.Node |
moveChildrenAway(int childPos)
MOves children away from the current node, returns new LCA |
int |
numChildren()
Returns the number of children |
void |
prepareLCA(int[] childPos)
Prepares the LCA, updates the position of a given child |
void |
reverseLCA(int[] childPos)
Reverses the current node (must be LCA of type Q) if this is necessary |
void |
reverseQNode()
Reverses the current node (must be Q) if this is necessary |
java.lang.String |
toString()
|
void |
transformPintoQ()
Transforms a gray P node into a Q node |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PQRTree.Node(PQRTree.NodeType t)
Method Detail |
---|
public void dropChild(int pos)
public void makeChildGrandchild(int pos, PQRTree.Node father, int newPos)
public void makeChildGrandchild(int pos, PQRTree.Node father)
public void makeGrandchildChild(PQRTree.Node father, int oldPos, int newPos)
public void addChild(PQRTree.Node n)
public void addChild(PQRTree.Node n, int pos)
public void addBlackLeaves(int num)
public void allocChildren(int n)
public PQRTree.Node colorAndGetLCA(int numS)
public PQRTree.Color color()
public boolean is(PQRTree.NodeType t)
public boolean isP()
public boolean isQ()
public boolean isR()
public boolean isLeaf()
public boolean is(PQRTree.Color t)
public boolean isWhite()
public boolean isBlack()
public boolean isGray()
public int numChildren()
public PQRTree.Node lastChild()
public PQRTree.Node firstChild()
public PQRTree.Node child(int pos)
public int grayChild()
public java.lang.String toString()
toString
in class java.lang.Object
public void debug(java.lang.Object... args)
public void transformPintoQ()
public void prepareLCA(int[] childPos)
public void mergeIntoLCA(int childPos)
public void reverseQNode()
public void reverseLCA(int[] childPos)
public PQRTree.Node moveChildrenAway(int childPos)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |