edu.toronto.cs.binarytree
Class BTNode

java.lang.Object
  extended by edu.toronto.cs.binarytree.BTNode

public class BTNode
extends java.lang.Object

This is a binary tree node.


Field Summary
protected  java.lang.Object Data
           
protected  BTNode left
           
protected  BTNode right
           
 
Constructor Summary
BTNode()
          Constructs a new BTNode assigning null to Data, right and left.
BTNode(java.lang.Object d)
          Constructs a new BTNode contaning the specified Object as its Data and sets right and left to null.
BTNode(java.lang.Object d, BTNode l, BTNode r)
          Constructs a new BTNode with given data as well as left and right children.
 
Method Summary
 java.lang.Object getData()
          Retrieves the Data from the BTNode.
 BTNode getLeft()
          Retrieves the left child of the BTNode.
 BTNode getRight()
          Retrieves the right child of the BTNode.
 void setData(java.lang.Object d)
          Changes the Data from the BTNode.
 void setLeft(BTNode l)
          Changes the left child of the BTNode.
 void setRight(BTNode r)
          Changes the right child of the BTNode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Data

protected java.lang.Object Data

right

protected BTNode right

left

protected BTNode left
Constructor Detail

BTNode

public BTNode()
Constructs a new BTNode assigning null to Data, right and left.


BTNode

public BTNode(java.lang.Object d)
Constructs a new BTNode contaning the specified Object as its Data and sets right and left to null.

Parameters:
d - data to be stored in the node.

BTNode

public BTNode(java.lang.Object d,
              BTNode l,
              BTNode r)
Constructs a new BTNode with given data as well as left and right children.

Parameters:
d - data to be stored in the node.
l - left child.
r - right child.
Method Detail

getData

public java.lang.Object getData()
Retrieves the Data from the BTNode.

Returns:
data contained in the node.

getLeft

public BTNode getLeft()
Retrieves the left child of the BTNode.

Returns:
left child.

getRight

public BTNode getRight()
Retrieves the right child of the BTNode.

Returns:
right child.

setData

public void setData(java.lang.Object d)
Changes the Data from the BTNode.


setLeft

public void setLeft(BTNode l)
Changes the left child of the BTNode.


setRight

public void setRight(BTNode r)
Changes the right child of the BTNode.