|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.datastructures.LinkedBinaryTree<Entry<K,V>>
net.datastructures.BinarySearchTree<K,V>
net.datastructures.RBTree<K,V>
support.convexhull.RobotRBTree<K,V>
K - KeyV - Valuepublic class RobotRBTree<K,V>
This is a subclass of net.datastructures.RBTree with some additional
useful function for implementing Robot. Each 'node', an instance of RBTree.RBNode,
is an implementation of Position<Entry<K,V>>.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.datastructures.RBTree |
|---|
RBTree.RBNode<K,V> |
| Nested classes/interfaces inherited from class net.datastructures.BinarySearchTree |
|---|
BinarySearchTree.BSTEntry<K,V> |
| Field Summary | |
|---|---|
static support.convexhull.RobotRBTree.InvalidEntry |
BOUNDARY_VIOLATION
BOUNDARY_VIOLATION is returned when boundary is violated. |
| Fields inherited from class net.datastructures.BinarySearchTree |
|---|
actionPos, C, numEntries |
| Fields inherited from class net.datastructures.LinkedBinaryTree |
|---|
root, size |
| Constructor Summary | |
|---|---|
RobotRBTree()
Simple constructor |
|
RobotRBTree(Comparator<K> C)
Simple constructor with a Comparator C. |
|
| Method Summary | |
|---|---|
Entry<K,V> |
after(Entry<K,V> entry)
This takes an Entry and returns the 'next' Entry |
Position<Entry<K,V>> |
after(Position<Entry<K,V>> current)
This returns the Position<Entry<K,V>> which is right after(bigger in Integer case) the current position. |
Entry<K,V> |
before(Entry<K,V> entry)
This takes an Entry and returns the 'previous' Entry |
Position<Entry<K,V>> |
before(Position<Entry<K,V>> current)
This returns the Position<Entry<K,V>> which is right before(bigger in Integer case) the current position. |
Entry<K,V> |
closestAfter(K key)
Takes O(logN) time -- traverses the height of the tree once. |
Entry<K,V> |
closestBefore(K key)
Takes O(logN) time -- traverses the height of the tree once. |
Entry<K,V> |
first()
Takes O(log N) time to traverse the height of the tree where N is the number of locators in the tree and O(logN) is the height of the tree |
protected void |
inorderPositions(Position<Entry<K,V>> v,
PositionList<Position<Entry<K,V>>> pos)
takes PositionList and add all elements of the tree in inorder. |
Iterator<Entry<K,V>> |
iterator()
|
Entry<K,V> |
last()
Takes O(log N) time to traverse the height of the tree where N is the number of locators in the tree and O(logN) is the height of the tree |
| Methods inherited from class net.datastructures.RBTree |
|---|
createNode, hasRedChild, insert, isPosRed, redChild, remedyDoubleBlack, remedyDoubleRed, remove, setBlack, setColor, setRed, swap, swapColor |
| Methods inherited from class net.datastructures.BinarySearchTree |
|---|
addAll, checkEntry, checkKey, entries, entry, find, findAll, insertAtExternal, isEmpty, key, removeExternal, replaceEntry, restructure, size, treeSearch, value |
| Methods inherited from class net.datastructures.LinkedBinaryTree |
|---|
addRoot, attach, checkPosition, children, expandExternal, hasLeft, hasRight, insertLeft, insertRight, isExternal, isInternal, isRoot, left, parent, positions, preorderPositions, remove, removeAboveExternal, replace, right, root, sibling, swapElements |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.datastructures.Dictionary |
|---|
entries, find, findAll, isEmpty, size |
| Field Detail |
|---|
public static support.convexhull.RobotRBTree.InvalidEntry BOUNDARY_VIOLATION
| Constructor Detail |
|---|
public RobotRBTree()
public RobotRBTree(Comparator<K> C)
RobotRBTree rbt = new RobotRBTree(new IntegerComparator());
C - A comparator to be used to compare keys| Method Detail |
|---|
public Entry<K,V> closestBefore(K key)
throws InvalidKeyException
key -
InvalidKeyException
public Entry<K,V> closestAfter(K key)
throws InvalidKeyException
key -
InvalidKeyException
public Position<Entry<K,V>> after(Position<Entry<K,V>> current)
throws BoundaryViolationException
current -
BoundaryViolationException
public Position<Entry<K,V>> before(Position<Entry<K,V>> current)
throws BoundaryViolationException
current -
BoundaryViolationExceptionpublic Entry<K,V> first()
public Entry<K,V> last()
public Iterator<Entry<K,V>> iterator()
iterator in interface Tree<Entry<K,V>>iterator in class LinkedBinaryTree<Entry<K,V>>
protected void inorderPositions(Position<Entry<K,V>> v,
PositionList<Position<Entry<K,V>>> pos)
throws InvalidPositionException
inorderPositions in class LinkedBinaryTree<Entry<K,V>>v - rootpos - PositionList to be stored
InvalidPositionExceptionpublic Entry<K,V> after(Entry<K,V> entry)
entry -
public Entry<K,V> before(Entry<K,V> entry)
entry -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||