jdsl
Class LinkedBinaryTree
java.lang.Object
|
+--jdsl.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.
- See Also:
BinaryTree
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
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)
- Specified by:
- leftChild in interface BinaryTree
rightChild
public Position rightChild(Position v)
- Specified by:
- rightChild in interface BinaryTree
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.Iterator children(Position v)
siblings
public java.util.Iterator siblings(Position v)
sibling
public Position sibling(Position v)
- Specified by:
- sibling in interface BinaryTree
elements
public java.util.Iterator elements()
positions
public java.util.Iterator 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