net.junaraki.libtree
Interface RootedTree<T>

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

public interface RootedTree<T>
extends Tree<T>

An interface for a rooted tree.

Author:
Jun Araki

Method Summary
 void createRoot()
          Creates the root of this tree.
 RootedTreeNode<T> getRoot()
          Returns the root of this tree.
 boolean hasRoot()
          Returns true if this tree has the root; otherwise returns false.
 void setRoot(RootedTreeNode<T> root)
          Sets the specified node to the root of this tree.
 
Methods inherited from interface net.junaraki.libtree.Tree
contains, getHeight, isEmpty, search, size
 

Method Detail

createRoot

void createRoot()
Creates the root of this tree.


getRoot

RootedTreeNode<T> getRoot()
Returns the root of this tree.

Returns:
the root of this tree

setRoot

void setRoot(RootedTreeNode<T> root)
Sets the specified node to the root of this tree.

Parameters:
root -

hasRoot

boolean hasRoot()
Returns true if this tree has the root; otherwise returns false.

Returns:
true if this tree has the root