org.fhcrc.cpl.toolbox.datastructure
Class BinaryTreeNode<T>

java.lang.Object
  extended by org.fhcrc.cpl.toolbox.datastructure.TreeNode<T>
      extended by org.fhcrc.cpl.toolbox.datastructure.BinaryTreeNode<T>

public class BinaryTreeNode<T>
extends TreeNode<T>

Binary tree node


Field Summary
protected  BinaryTreeNode leftChild
           
protected  BinaryTreeNode rightChild
           
 
Fields inherited from class org.fhcrc.cpl.toolbox.datastructure.TreeNode
children, data
 
Constructor Summary
BinaryTreeNode()
           
 
Method Summary
 void addChild(TreeNode<T> child)
          Adds a child to the list of children for this Node.
 BinaryTreeNode<T> getLeftChild()
           
 BinaryTreeNode<T> getRightChild()
           
 boolean hasLeftChild()
           
 boolean hasRightChild()
           
 void insertChildAt(int index, TreeNode<T> child)
          Inserts a Node at the specified position in the child list.
 void setLeftChild(TreeNode<T> newNode)
           
 void setRightChild(TreeNode<T> newNode)
           
 
Methods inherited from class org.fhcrc.cpl.toolbox.datastructure.TreeNode
getChildren, getData, getNumberOfChildren, isLeafNode, removeChild, removeChildAt, setChildren, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leftChild

protected BinaryTreeNode leftChild

rightChild

protected BinaryTreeNode rightChild
Constructor Detail

BinaryTreeNode

public BinaryTreeNode()
Method Detail

addChild

public void addChild(TreeNode<T> child)
Description copied from class: TreeNode
Adds a child to the list of children for this Node. The addition of the first child will create a new List>.

Overrides:
addChild in class TreeNode<T>
Parameters:
child - a Node object to set.

insertChildAt

public void insertChildAt(int index,
                          TreeNode<T> child)
                   throws java.lang.IndexOutOfBoundsException
Description copied from class: TreeNode
Inserts a Node at the specified position in the child list. Will * throw an ArrayIndexOutOfBoundsException if the index does not exist.

Overrides:
insertChildAt in class TreeNode<T>
Parameters:
index - the position to insert at.
child - the Node object to insert.
Throws:
java.lang.IndexOutOfBoundsException - if thrown.

setLeftChild

public void setLeftChild(TreeNode<T> newNode)

setRightChild

public void setRightChild(TreeNode<T> newNode)

hasLeftChild

public boolean hasLeftChild()

hasRightChild

public boolean hasRightChild()

getLeftChild

public BinaryTreeNode<T> getLeftChild()

getRightChild

public BinaryTreeNode<T> getRightChild()


Fred Hutchinson Cancer Research Center