|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectredblacktreeproject.RedBlackNode
public class RedBlackNode
| Field Summary | |
|---|---|
static int |
BLACK
|
static int |
RED
|
| Constructor Summary | |
|---|---|
RedBlackNode(int data,
int color,
RedBlackNode p,
RedBlackNode lc,
RedBlackNode rc)
Construct a RedBlackNode with data, color, parent pointer, left child pointer and right child pointer. |
|
| Method Summary | |
|---|---|
int |
getColor()
The getColor() method returns RED or BLACK. |
int |
getData()
The getData() method returns the data in the node. |
RedBlackNode |
getLc()
The getLc() method returns the left child of the RedBlackNode. |
RedBlackNode |
getP()
The getP() method returns the parent of the RedBlackNode. |
RedBlackNode |
getRc()
The getRc() method returns the right child of the RedBlackNode. |
void |
setColor(int color)
The setColor() method sets the color of the RedBlackNode. |
void |
setData(int data)
The setData() method sets the data or key of the RedBlackNode. |
void |
setLc(RedBlackNode lc)
The setLc() method sets the left child of the RedBlackNode. |
void |
setP(RedBlackNode p)
The setP() method sets the parent of the RedBlackNode. |
void |
setRc(RedBlackNode rc)
The setRc() method sets the right child of the RedBlackNode. |
java.lang.String |
toString()
The toString() methods returns a string representation of the RedBlackNode. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int RED
public static final int BLACK
| Constructor Detail |
|---|
public RedBlackNode(int data,
int color,
RedBlackNode p,
RedBlackNode lc,
RedBlackNode rc)
data - a simple value held in the treecolor - either RED or BLACKp - the parent pointerlc - the pointer to the left child (will be null only for the node
that represents all external nulls.rc - the pointer to the right child (will be null only for the
node that represents all external nulls.| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic int getColor()
public int getData()
public RedBlackNode getLc()
public RedBlackNode getP()
public RedBlackNode getRc()
public void setColor(int color)
color - is either RED or BLACKpublic void setData(int data)
data - is an int holding a node's data valuepublic void setLc(RedBlackNode lc)
lc - establishes a left child for this nodepublic void setP(RedBlackNode p)
p - establishes a parent pointer for this nodepublic void setRc(RedBlackNode rc)
rc - establishes a right child for this node.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||