Class MutableBinaryTree

java.lang.Object
  extended by BinaryTree
      extended by MutableBinaryTree

public final class MutableBinaryTree
extends BinaryTree

MutableBinaryTree class that extends BinaryTree to make the toString methods reusable and to make a parse method to make a mutableBinaryTree out of a mutable binary tree in form of a string.


Field Summary
static MutableBinaryTree NIL
           
 
Fields inherited from class BinaryTree
left, right, root
 
Constructor Summary
MutableBinaryTree()
           
MutableBinaryTree(java.lang.Comparable d)
           
MutableBinaryTree(java.lang.Comparable d, MutableBinaryTree left, MutableBinaryTree right)
           
 
Method Summary
 boolean isEmpty()
           
 MutableBinaryTree left()
           
static MutableBinaryTree parseMutableBinaryTreeString(java.lang.String input)
          Public method to convert a string to a mutable binary tree
 MutableBinaryTree right()
           
 java.lang.String toString()
           
 
Methods inherited from class BinaryTree
insert, insertDestructive, nil, parseBinaryTreeInts, root, setData, setLeft, setRight, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NIL

public static final MutableBinaryTree NIL
Constructor Detail

MutableBinaryTree

public MutableBinaryTree()

MutableBinaryTree

public MutableBinaryTree(java.lang.Comparable d)

MutableBinaryTree

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

left

public MutableBinaryTree left()
Overrides:
left in class BinaryTree

right

public MutableBinaryTree right()
Overrides:
right in class BinaryTree

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in class BinaryTree

toString

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

parseMutableBinaryTreeString

public static MutableBinaryTree parseMutableBinaryTreeString(java.lang.String input)
Public method to convert a string to a mutable binary tree

Parameters:
input - the mutable binary tree in form of a string
Returns: