beowulf.model.tree
Class BinaryTreeNode

java.lang.Object
  extended bybeowulf.model.tree.BinaryTreeNode
All Implemented Interfaces:
MutableTreeNode, TreeNode

public class BinaryTreeNode
extends Object
implements MutableTreeNode

Version:
1.0, 11/15/2003
Author:
Andy Scukanec (ags at cs dot cornell dot edu)

Field Summary
protected  BinaryTreeNode left
          Holds a reference to the left child.
static int LEFT_NODE
           
protected  BinaryTreeNode parent
          Holds a reference to the parent node.
protected  BinaryTreeNode right
          Holds a reference to the right child.
static int RIGHT_NODE
           
protected  Object value
          Holds the a reference to the value of this node.
 
Constructor Summary
BinaryTreeNode(Object newValue)
           
 
Method Summary
 Enumeration children()
           
 boolean getAllowsChildren()
           
 TreeNode getChildAt(int index)
           
 int getChildCount()
           
 int getIndex(TreeNode node)
           
 BinaryTreeNode getLeft()
           
 TreeNode getParent()
           
 BinaryTreeNode getRight()
           
 Object getUserObject()
           
 void insert(MutableTreeNode child, int index)
           
 boolean isLeaf()
           
 void remove(int index)
           
 void remove(MutableTreeNode oldChild)
           
 void removeFromParent()
           
 void setLeft(BinaryTreeNode node)
           
 void setParent(MutableTreeNode newParent)
           
 void setRight(BinaryTreeNode node)
           
 void setUserObject(Object newValue)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT_NODE

public static final int LEFT_NODE
See Also:
Constant Field Values

RIGHT_NODE

public static final int RIGHT_NODE
See Also:
Constant Field Values

parent

protected BinaryTreeNode parent
Holds a reference to the parent node.


value

protected Object value
Holds the a reference to the value of this node.


left

protected BinaryTreeNode left
Holds a reference to the left child.


right

protected BinaryTreeNode right
Holds a reference to the right child.

Constructor Detail

BinaryTreeNode

public BinaryTreeNode(Object newValue)
Method Detail

getUserObject

public Object getUserObject()

getParent

public TreeNode getParent()
Specified by:
getParent in interface TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface TreeNode

children

public Enumeration children()
Specified by:
children in interface TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface TreeNode

getChildAt

public TreeNode getChildAt(int index)
Specified by:
getChildAt in interface TreeNode

getLeft

public BinaryTreeNode getLeft()

getRight

public BinaryTreeNode getRight()

getIndex

public int getIndex(TreeNode node)
Specified by:
getIndex in interface TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface TreeNode

insert

public void insert(MutableTreeNode child,
                   int index)
Specified by:
insert in interface MutableTreeNode

setLeft

public void setLeft(BinaryTreeNode node)

setRight

public void setRight(BinaryTreeNode node)

removeFromParent

public void removeFromParent()
Specified by:
removeFromParent in interface MutableTreeNode

remove

public void remove(int index)
Specified by:
remove in interface MutableTreeNode

remove

public void remove(MutableTreeNode oldChild)
Specified by:
remove in interface MutableTreeNode

setParent

public void setParent(MutableTreeNode newParent)
Specified by:
setParent in interface MutableTreeNode

setUserObject

public void setUserObject(Object newValue)
Specified by:
setUserObject in interface MutableTreeNode

toString

public String toString()