Class TreeNode

java.lang.Object
  extended by TreeNode

public class TreeNode
extends Object

Class that represents a binary tree node

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
TreeNode(String something)
          Constructor that takes the string to store
 
Method Summary
 String getData()
          Method to return the data
 TreeNode getLeft()
          Method to get the left child
 TreeNode getRight()
          Method to get the right child
 void setData(String something)
          Method to set the data at this node
 void setLeft(TreeNode newLeft)
          Method to set the left child
 void setRight(TreeNode newRight)
          Method to set the right child
 String toString()
          Method to return a string of information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeNode

public TreeNode(String something)
Constructor that takes the string to store

Parameters:
something - the string to store
Method Detail

getData

public String getData()
Method to return the data

Returns:
the string data at this node

setData

public void setData(String something)
Method to set the data at this node

Parameters:
something - the data to use

getLeft

public TreeNode getLeft()
Method to get the left child

Returns:
the left child (may be null)

getRight

public TreeNode getRight()
Method to get the right child

Returns:
the right child (may be null)

setLeft

public void setLeft(TreeNode newLeft)
Method to set the left child

Parameters:
newLeft - the new left child

setRight

public void setRight(TreeNode newRight)
Method to set the right child

Parameters:
newRight - the new right child

toString

public String toString()
Method to return a string of information

Overrides:
toString in class Object
Returns:
the information string