jdsl.core.ref
Class LinkedBinaryTree
java.lang.Object
|
+--jdsl.core.ref.LinkedBinaryTree
- public class LinkedBinaryTree
- extends java.lang.Object
- implements BinaryTree
This class is a speedy implementation of the BinaryTree interface.
It implements only the following subset of BinaryTree's methods:
size,isEmpty,replace,leftChild,rightChild,parent,isInternal,isExternal,
isRoot,root,and expandExternal.
- Author:
- Luca Vismara, Roberto Tamassia
- See Also:
BinaryTree
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
LinkedBinaryTree
public LinkedBinaryTree()
size
public int size()
isEmpty
public boolean isEmpty()
replace
public java.lang.Object replace(Position v,
java.lang.Object o)
leftChild
public Position leftChild(Position v)
rightChild
public Position rightChild(Position v)
parent
public Position parent(Position v)
isInternal
public boolean isInternal(Position v)
isExternal
public boolean isExternal(Position v)
isRoot
public boolean isRoot(Position v)
root
public Position root()
expandExternal
public void expandExternal(Position v)
- Specified by:
- expandExternal in interface BinaryTree
newContainer
public Container newContainer()
children
public java.util.Enumeration children(Position v)
siblings
public java.util.Enumeration siblings(Position v)
sibling
public Position sibling(Position v)
elements
public java.util.Enumeration elements()
positions
public java.util.Enumeration positions()
swap
public void swap(Position v,
Position w)
removeAboveExternal
public void removeAboveExternal(Position v)
- Specified by:
- removeAboveExternal in interface BinaryTree
cut
public BinaryTree cut(Position subtreeRoot)
- Specified by:
- cut in interface BinaryTree
link
public void link(Position mustBeExternal,
BinaryTree newSubtree)
- Specified by:
- link in interface BinaryTree
replaceSubtree
public BinaryTree replaceSubtree(Position subtreeRoot,
BinaryTree newSubtree)
- Specified by:
- replaceSubtree in interface BinaryTree