net.junaraki.libtree
Interface Tree<T>

Type Parameters:
T - the type of elements maintained by this tree
All Known Subinterfaces:
BinaryTree<T>, RootedTree<T>
All Known Implementing Classes:
AbstractBinaryTree, AbstractOrderedTree, AbstractRootedTree, AbstractTree, BinarySearchTree, OrderedTree, UnorderedTree

public interface Tree<T>

An interface for a tree.

Author:
Jun Araki

Method Summary
 boolean contains(java.lang.Object o)
          Returns true if this tree contains a node with the specified element; otherwise returns false.
 int getHeight()
          Returns the height of this tree.
 boolean isEmpty()
          Returns true if this tree contains no elements.
 TreeNode<T> search(java.lang.Object o)
          Returns the node of this tree with the specified element.
 int size()
          Returns the size of this tree, i.e., the number of elements in this tree.
 

Method Detail

size

int size()
Returns the size of this tree, i.e., the number of elements in this tree.

Returns:
the size of this tree

isEmpty

boolean isEmpty()
Returns true if this tree contains no elements.

Returns:
true if this tree contains no elements

getHeight

int getHeight()
Returns the height of this tree.

Returns:
the height of this tree

contains

boolean contains(java.lang.Object o)
Returns true if this tree contains a node with the specified element; otherwise returns false.

Parameters:
o -
Returns:
true if this tree contains a node with the specified element

search

TreeNode<T> search(java.lang.Object o)
Returns the node of this tree with the specified element.

Parameters:
o -
Returns:
the node of this tree with the specified element