public class OrderLinkedRedBlackTree<T> extends RedBlackTree<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
OrderLinkedRedBlackTree.Node<T>
A red-black tree node augmented to store pointers to its predecessor and
successor.
|
| Constructor and Description |
|---|
OrderLinkedRedBlackTree()
Default constructor.
|
OrderLinkedRedBlackTree(Comparator<T> comparator)
Construct a new instance which uses the specified comparator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all entries from this tree.
|
protected RedBlackTree.Node<T> |
createNewNode(T value)
Create a new node with the specified value.
|
RedBlackTree.Node<T> |
delete(T value)
Delete the specified value from this tree.
|
protected void |
exchangeValues(RedBlackTree.Node<T> node,
RedBlackTree.Node<T> successor)
Called by
RedBlackTree.delete(T) when the node to be removed is a leaf. |
RedBlackTree.Node<T> |
getFirstNode()
Get the node containing the smallest value held by this tree.
|
RedBlackTree.Node<T> |
getPredecessor(RedBlackTree.Node<T> node)
Get the predecessor of the specified node.
|
RedBlackTree.Node<T> |
getSuccessor(RedBlackTree.Node<T> node)
Get the successor of the specified node.
|
RedBlackTree.Node<T> |
insert(T value)
Insert the specified value into this tree.
|
contains, fixAfterDeletion, fixAfterInsertion, getNode, getRoot, getSize, isEmpty, iterator, leftRotate, rightRotate, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic OrderLinkedRedBlackTree()
public OrderLinkedRedBlackTree(Comparator<T> comparator)
comparator - the comparator to use when ordering elements.public void clear()
clear in class RedBlackTree<T>protected RedBlackTree.Node<T> createNewNode(T value)
createNewNode in class RedBlackTree<T>value - the value to apply to the new node.public RedBlackTree.Node<T> delete(T value)
delete in class RedBlackTree<T>value - the value to delete.protected void exchangeValues(RedBlackTree.Node<T> node, RedBlackTree.Node<T> successor)
RedBlackTree.delete(T) when the node to be removed is a leaf. In
this case, the node's value is exchanged with its successor as per the
typical binary tree node removal operation. This method allows a subclass
to influence value exchange behavior (e.g. if additional node information
needs to be exchanged).exchangeValues in class RedBlackTree<T>node - the node whose value is to be removed.successor - the node to actually be removed.public RedBlackTree.Node<T> getFirstNode()
getFirstNode in class RedBlackTree<T>public RedBlackTree.Node<T> getPredecessor(RedBlackTree.Node<T> node)
getPredecessor in class RedBlackTree<T>node - the node compared to which predecessor node will be foundpublic RedBlackTree.Node<T> getSuccessor(RedBlackTree.Node<T> node)
getSuccessor in class RedBlackTree<T>node - the node compared to which successor node will be foundpublic RedBlackTree.Node<T> insert(T value)
insert in class RedBlackTree<T>value - the value to insert.Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.