|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpqrtree.Node
pqrtree.PQRNode
public class PQRNode
A PQRNode
object is an intern
node of PQRTree. It can be type P, Q or R.
Every P Node has at least 2 children, that
can be arbitrary permutated.
Every Q Node has at least 3 children, that
can be reversed.
Every R Node has at least 3 children, that
can be arbitrary permutated. The R nodes
encapsulate subsets where the consecutive
ones proprety fails.
Node
Field Summary | |
---|---|
private ColoredDoublyLinkedList |
blackChildren
|
private ChildrenDoublyLinkedList |
children
|
private boolean |
deleted
|
private ColoredDoublyLinkedList |
grayChildren
|
private int |
pertinentLeaves
|
private int |
pertinentPaths
|
private int |
type
|
Fields inherited from class pqrtree.Node |
---|
ancestor, ancestorListPosition, ancestorReference, COLOR_BLACK, COLOR_GRAY, COLOR_WHITE, DRAW_BLACK_COLOR, DRAW_BOUNDARY_SIZE, DRAW_CONNECTOR_SIZE, DRAW_GRAY_COLOR, DRAW_NORMAL_COLOR, DRAW_SIZE, DRAW_WHITE_COLOR, leaf, TYPE_PNODE, TYPE_QNODE, TYPE_RNODE |
Constructor Summary | |
---|---|
PQRNode(int type,
PQRNode ancestor)
Creates a new internal node of the PQRTree, type P, Q or R, linked to it's ancestor. |
Method Summary | |
---|---|
void |
addBlackChild(Node child)
Adds a child node to the end of the black children's list. |
void |
addChild(Node child)
Adds a node to the end of the children's list. |
void |
addGrayChild(Node child)
Adds a child node to the end of the gray children's list. |
boolean |
areAllChildrenBlack()
Verifies if all children are black. |
boolean |
areBlackChildrenConsecutive()
Verifies if all black children are consecutive. |
void |
clearBlackChildren()
Empties the black children's list. |
void |
clearChildren()
Empties the children's list. |
void |
clearGrayChildren()
Empties the gray children's list. |
void |
decPertinentPaths()
Decrements the pertinent paths counter by one. |
ColoredDoublyLinkedList |
getBlackChildren()
Gets the black children's list and returns it. |
ChildrenDoublyLinkedList |
getChildren()
Gets the children's list and returns it. |
ListNode |
getFirstChild()
Gets the first child, and returns it. |
PQRNode |
getGrayChild()
Gets a gray child node, and returns it. |
ColoredDoublyLinkedList |
getGrayChildren()
Gets the gray children's list and returns it. |
ListNode |
getLastChild()
Gets the last child, and returns it. |
int |
getPertinentLeaves()
Gets the pertinent leaves counter value. |
int |
getPertinentPaths()
Gets the pertinent paths counter value. |
int |
getType()
Returns the type of the node. |
boolean |
hasGrayChildren()
Verifies if the node has at least one gray child. |
void |
incPertinentLeaves(int i)
Increments the pertinent leaves counter by a integer value. |
void |
incPertinentPaths()
Increments the pertinent paths counter by one. |
void |
setBlackChildren(ColoredDoublyLinkedList newList)
Changes the black children's list by another one. |
void |
setChildren(ChildrenDoublyLinkedList newList)
Changes the children's list by another one. |
void |
setDeleted()
Sets the node as deleted. |
void |
setGrayChildren(ColoredDoublyLinkedList newList)
Changes the gray children's list by another one. |
void |
setPertinentLeaves(int newValue)
Sets the pertinent leaves counter to a new value. |
void |
setPertinentPaths(int newValue)
Sets the pertinent paths counter to a new value. |
void |
setType(int type)
Sets the type of the node. |
void |
substitutedBy(PQRNode v)
Substitutes the node by another one. |
boolean |
wasDeleted()
Verifies if the node was deleted |
void |
zeroPertinentLeaves()
Sets the pertinent leaves counter to zero. |
void |
zeroPertinentPaths()
Sets the pertinent paths counter to zero. |
Methods inherited from class pqrtree.Node |
---|
countSubLeaves, drawNode, findLeader, getAncestor, getAncestorListPosition, getAncestorReference, getColor, getDepth, getParent, isLeaf, setAncestor, setAncestorListPosition, setAncestorReference, setColor, setParent, union, visited, wasVisited |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int type
private int pertinentPaths
private int pertinentLeaves
private boolean deleted
private ChildrenDoublyLinkedList children
private ColoredDoublyLinkedList blackChildren
private ColoredDoublyLinkedList grayChildren
Constructor Detail |
---|
public PQRNode(int type, PQRNode ancestor)
type
- The type of the internal node. Could be a P, Q or R node.ancestor
- The internal node from which the new node descend.Node.Node(PQRNode)
Method Detail |
---|
public int getType()
public void setType(int type)
type
- The type of the node: P, Q or R node.public void incPertinentPaths()
public void decPertinentPaths()
public void zeroPertinentPaths()
public void setPertinentPaths(int newValue)
newValue
- The new pertinent paths value.public int getPertinentPaths()
public void incPertinentLeaves(int i)
i
- The value of pertinent leaves to be added to
the pertinent leaves counter.public void zeroPertinentLeaves()
public void setPertinentLeaves(int newValue)
newValue
- The new pertinent leaves value.public int getPertinentLeaves()
public ChildrenDoublyLinkedList getChildren()
public ColoredDoublyLinkedList getBlackChildren()
public ColoredDoublyLinkedList getGrayChildren()
public void setChildren(ChildrenDoublyLinkedList newList)
newList
- A new children's list.public void setBlackChildren(ColoredDoublyLinkedList newList)
newList
- A new black children's list.public void setGrayChildren(ColoredDoublyLinkedList newList)
newList
- A new gray children's list.public boolean areBlackChildrenConsecutive()
true
, if all black children are consecutive, or false
,
if they aren't.public boolean areAllChildrenBlack()
true
, if all children are black, or false
,
if they aren't.public void addChild(Node child)
child
- Node to be added to the children's list.public void addBlackChild(Node child)
child
- Node to be considered black by the ancestor.public void addGrayChild(Node child)
child
- Node to be considered gray by the ancestor.public void clearBlackChildren()
public void clearGrayChildren()
public void clearChildren()
public boolean hasGrayChildren()
true
, if it has at least onde gray child, or false
,
if it doesn't.public PQRNode getGrayChild()
public ListNode getFirstChild()
public ListNode getLastChild()
public void substitutedBy(PQRNode v)
v
- The node that will substitutes this one. v must be a Q or R node.public boolean wasDeleted()
true
, if the was deleted,
or false
, if it wasn't.public void setDeleted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |