Class BinaryTree

java.lang.Object
  extended by BinaryTree
Direct Known Subclasses:
MutableBinaryTree

public class BinaryTree
extends java.lang.Object

BinaryTree class done by the professor.


Field Summary
protected  BinaryTree left
           
static BinaryTree NIL
           
protected  BinaryTree right
           
protected  java.lang.Comparable root
           
 
Constructor Summary
protected BinaryTree()
           
  BinaryTree(java.lang.Comparable d)
           
  BinaryTree(java.lang.Comparable d, BinaryTree left, BinaryTree right)
           
 
Method Summary
 BinaryTree insert(BinaryTree newNode)
           
 BinaryTree insertDestructive(BinaryTree newNode)
           
 boolean isEmpty()
           
 BinaryTree left()
           
 BinaryTree nil()
           
static BinaryTree parseBinaryTreeInts(java.lang.String s)
           
 BinaryTree right()
           
 java.lang.Comparable root()
           
 void setData(java.lang.Comparable d)
           
 void setLeft(BinaryTree t)
           
 void setRight(BinaryTree t)
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

root

protected java.lang.Comparable root

left

protected BinaryTree left

right

protected BinaryTree right

NIL

public static final BinaryTree NIL
Constructor Detail

BinaryTree

protected BinaryTree()

BinaryTree

public BinaryTree(java.lang.Comparable d)

BinaryTree

public BinaryTree(java.lang.Comparable d,
                  BinaryTree left,
                  BinaryTree right)
Method Detail

nil

public BinaryTree nil()

root

public java.lang.Comparable root()

left

public BinaryTree left()

right

public BinaryTree right()

setData

public void setData(java.lang.Comparable d)

setLeft

public void setLeft(BinaryTree t)

setRight

public void setRight(BinaryTree t)

isEmpty

public boolean isEmpty()

insert

public BinaryTree insert(BinaryTree newNode)

insertDestructive

public BinaryTree insertDestructive(BinaryTree newNode)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String order)

parseBinaryTreeInts

public static BinaryTree parseBinaryTreeInts(java.lang.String s)