fi.joensuu.cs.tra
Class BTree<E>

java.lang.Object
  extended by fi.joensuu.cs.tra.BTree<E>

public class BTree<E>
extends Object

BTree is a wrapper class for a root BTreeNode.

See Also:
BTreeNode

Constructor Summary
BTree()
          Creates an empty BTree.
BTree(BTreeNode<E> node)
          Creates a BTree with the specified BTreeNode as the root node.
 
Method Summary
 void destroyNode(BTreeNode<E> node)
          Removes a single node.
 BTreeNode<E> getRoot()
          Returns the root of this BTree.
 boolean isEmpty()
          Returns true if this BTree is empty.
 BTreeNode<E> setRoot(BTreeNode<E> node)
          Sets the root of this BTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTree

public BTree()
Creates an empty BTree.


BTree

public BTree(BTreeNode<E> node)
Creates a BTree with the specified BTreeNode as the root node.

Parameters:
node - the root node for the BTree.
Method Detail

setRoot

public BTreeNode<E> setRoot(BTreeNode<E> node)
Sets the root of this BTree.

Parameters:
node - the new root BTreeNode.
Returns:
the old root BTreeNode.

getRoot

public BTreeNode<E> getRoot()
Returns the root of this BTree.

Returns:
the root BTreeNode or null if this BTree is empty.

isEmpty

public boolean isEmpty()
Returns true if this BTree is empty.

Returns:
true if the root BTreeNode is null, false otherwise.

destroyNode

public void destroyNode(BTreeNode<E> node)
Removes a single node. Childs will be lost too.

Parameters:
node - the node to remove.
Throws:
NullPointerException - if node is null.