asd_library.tree.avltree
Class AvlNode

java.lang.Object
  |
  +--asd_library.tree.avltree.AvlNode

public class AvlNode
extends java.lang.Object

Basic node stored in AVL trees


Field Summary
protected  java.lang.Comparable element
          The data in the node
protected  int height
          Height
protected  AvlNode left
          Left child
protected  AvlNode right
          Right child
 
Constructor Summary
(package private) AvlNode(java.lang.Comparable theElement)
          Creates a new node without children.
(package private) AvlNode(java.lang.Comparable theElement, AvlNode lt, AvlNode rt)
          Creates a new node with children and heigth equals to zero
 
Method Summary
 java.lang.Comparable getElement()
          Returns the element of the node.
 AvlNode getLeftChild()
          Returns the left child of the node.
 AvlNode getRightChild()
          Returns the right child of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected java.lang.Comparable element
The data in the node


left

protected AvlNode left
Left child


right

protected AvlNode right
Right child


height

protected int height
Height

Constructor Detail

AvlNode

AvlNode(java.lang.Comparable theElement)
Creates a new node without children.

Parameters:
theElement - to insert.

AvlNode

AvlNode(java.lang.Comparable theElement,
        AvlNode lt,
        AvlNode rt)
Creates a new node with children and heigth equals to zero

Parameters:
theElement - the key of the node.
lt - the left child.
rt - the right child.
Method Detail

getElement

public java.lang.Comparable getElement()
Returns the element of the node.

Returns:
the element of this node

getRightChild

public AvlNode getRightChild()
Returns the right child of the node.

Returns:
the right child AvlNode.

getLeftChild

public AvlNode getLeftChild()
Returns the left child of the node.

Returns:
the left child AvlNode.