|
libUTL++
|
Red/black tree node. More...
#include <RBtreeNode.h>

Public Types | |
| enum | color_t { BLACK, RED } |
| A node in a red/black tree is colored red or black. More... | |
Public Member Functions | |
| virtual void | addFixup () |
| Perform necessary re-balancing following the addition of a node. More... | |
| virtual void | removeFixup (const BinTreeNode *removedNode) |
| Perform re-balancing following the removal of a node. More... | |
| virtual void | swapWith (BinTreeNode *rhs) |
| Trade places with the given node. More... | |
| uint_t | getColor () const |
| Get the color (RED or BLACK). More... | |
| void | setColor (uint_t color) |
| Set the color (RED or BLACK). More... | |
| RBtreeNode * | sibling () const |
| Return self's sibling (nullptr if none). More... | |
Public Member Functions inherited from utl::BinTreeNode | |
| BinTreeNode () | |
| Constructor. More... | |
| virtual | ~BinTreeNode () |
| Destructor. More... | |
| BinTreeNode (const Object *object) | |
| Constructor. More... | |
| Object * | get () const |
| Get the contained object. More... | |
| bool | isLeaf () const |
| Determine whether self is a leaf node. More... | |
| bool | isLeftChild () const |
| Determine whether self is a left child. More... | |
| bool | isRightChild () const |
| Determine whether self is a right child. More... | |
| bool | isRoot () const |
| Determine whether self is the root node. More... | |
| BinTreeNode * | left () const |
| Return the left child. More... | |
| const BinTreeNode * | leftMost () const |
| Return the left-most child (smallest node reachable from self). More... | |
| BinTreeNode * | leftMost () |
| Return the left-most child (smallest node reachable from self). More... | |
| BinTreeNode * | next () const |
| Return the in-order successor. More... | |
| BinTreeNode * | parent () const |
| Return the parent node (nullptr if root). More... | |
| BinTreeNode * | prev () const |
| Return the in-order predecessor. More... | |
| void | remove (BinTreeNode *&x, BinTreeNode *&y) |
| Remove the node from the tree. More... | |
| BinTreeNode * | right () const |
| Return the right child. More... | |
| const BinTreeNode * | rightMost () const |
| Return the right-most child (largest node reachable from self). More... | |
| BinTreeNode * | rightMost () |
| Return the right-most child (largest node reachable from self). More... | |
| void | rotateLeft () |
| Perform a left rotation around self. More... | |
| void | rotateRight () |
| Perform a right rotation around self. More... | |
| void | set (const Object *object) |
| Set the contained object. More... | |
| void | setLeft (BinTreeNode *node) |
| Set the left child. More... | |
| void | setRight (BinTreeNode *node) |
| Set the right child. More... | |
| BinTreeNode * | sibling () const |
| Return the sibling node (nullptr if self is parent). More... | |
Red/black tree node.
You shouldn't need to use this class directly.
Attributes
Definition at line 29 of file RBtreeNode.h.
A node in a red/black tree is colored red or black.
| Enumerator | |
|---|---|
| BLACK | black node |
| RED | red node |
Definition at line 94 of file RBtreeNode.h.
|
virtual |
Perform necessary re-balancing following the addition of a node.
Implements utl::BinTreeNode.
|
virtual |
Perform re-balancing following the removal of a node.
Implements utl::BinTreeNode.
|
virtual |
Trade places with the given node.
Reimplemented from utl::BinTreeNode.
|
inline |
Get the color (RED or BLACK).
Definition at line 74 of file RBtreeNode.h.
|
inline |
Set the color (RED or BLACK).
Definition at line 81 of file RBtreeNode.h.
|
inline |
Return self's sibling (nullptr if none).
Definition at line 88 of file RBtreeNode.h.