net.datastructures
Class BTNode<E>

java.lang.Object
  extended by net.datastructures.BTNode<E>
All Implemented Interfaces:
BTPosition<E>, Position<E>

public class BTNode<E>
extends java.lang.Object
implements BTPosition<E>

Class implementing a node of a binary tree by storing references to an element, a parent node, a left node, and a right node.

Author:
Luca Vismara, Roberto Tamassia, Michael Goodrich

Constructor Summary
BTNode()
          Default constructor
BTNode(E element, BTPosition<E> parent, BTPosition<E> left, BTPosition<E> right)
          Main constructor
 
Method Summary
 E element()
          Returns the element stored at this position
 BTPosition<E> getLeft()
          Returns the left child of this position
 BTPosition<E> getParent()
          Returns the parent of this position
 BTPosition<E> getRight()
          Returns the right child of this position
 void setElement(E o)
          Sets the element stored at this position
 void setLeft(BTPosition<E> v)
          Sets the left child of this position
 void setParent(BTPosition<E> v)
          Sets the parent of this position
 void setRight(BTPosition<E> v)
          Sets the right child of this position
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTNode

public BTNode()
Default constructor


BTNode

public BTNode(E element,
              BTPosition<E> parent,
              BTPosition<E> left,
              BTPosition<E> right)
Main constructor

Method Detail

element

public E element()
Returns the element stored at this position

Specified by:
element in interface Position<E>

setElement

public void setElement(E o)
Sets the element stored at this position

Specified by:
setElement in interface BTPosition<E>

getLeft

public BTPosition<E> getLeft()
Returns the left child of this position

Specified by:
getLeft in interface BTPosition<E>

setLeft

public void setLeft(BTPosition<E> v)
Sets the left child of this position

Specified by:
setLeft in interface BTPosition<E>

getRight

public BTPosition<E> getRight()
Returns the right child of this position

Specified by:
getRight in interface BTPosition<E>

setRight

public void setRight(BTPosition<E> v)
Sets the right child of this position

Specified by:
setRight in interface BTPosition<E>

getParent

public BTPosition<E> getParent()
Returns the parent of this position

Specified by:
getParent in interface BTPosition<E>

setParent

public void setParent(BTPosition<E> v)
Sets the parent of this position

Specified by:
setParent in interface BTPosition<E>