jdsl.core.ref
Class RestructurableNodeBinaryTree

java.lang.Object
  |
  +--jdsl.core.ref.BTNodeBinaryTree
        |
        +--jdsl.core.ref.RestructurableNodeBinaryTree

public class RestructurableNodeBinaryTree
extends BTNodeBinaryTree
implements RestructurableBinaryTree

A BinaryTree that supports restructuring.

Author:
Ming-En Cho (mec), Mike Boilen (mgb)

Constructor Summary
RestructurableNodeBinaryTree()
          Construct a new restructurable binary tree.
 
Method Summary
 Container newContainer()
          Returns a new RestructurableNodeBinaryTree.
 Position restructure(Position grandchild)
          Restructures the tree at a given position.
 
Methods inherited from class jdsl.core.ref.BTNodeBinaryTree
children, cut, elements, expandExternal, head, isEmpty, isExternal, isInternal, isRoot, leftChild, link, parent, positions, removeAboveExternal, replace, replaceSubtree, rightChild, root, sibling, siblings, size, swap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestructurableNodeBinaryTree

public RestructurableNodeBinaryTree()
Construct a new restructurable binary tree.
Method Detail

restructure

public Position restructure(Position grandchild)
                     throws BoundaryViolationException,
                            InvalidPositionException
Restructures the tree at a given position.
Specified by:
restructure in interface RestructurableBinaryTree
Parameters:
grandchild - The position to rotate at.
Throws:
BoundaryViolationException - if grandchild does not have a grand parent.
InvalidPositionException - if grandchild is external.

newContainer

public Container newContainer()
Returns a new RestructurableNodeBinaryTree.
Returns:
a RestructurableNodeBinaryTree
Overrides:
newContainer in class BTNodeBinaryTree