libUTL++
utl::RBtreeNode Class Reference

Red/black tree node. More...

#include <RBtreeNode.h>

Inheritance diagram for utl::RBtreeNode:

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...
 
RBtreeNodesibling () 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...
 
Objectget () 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...
 
BinTreeNodeleft () const
 Return the left child. More...
 
const BinTreeNodeleftMost () const
 Return the left-most child (smallest node reachable from self). More...
 
BinTreeNodeleftMost ()
 Return the left-most child (smallest node reachable from self). More...
 
BinTreeNodenext () const
 Return the in-order successor. More...
 
BinTreeNodeparent () const
 Return the parent node (nullptr if root). More...
 
BinTreeNodeprev () const
 Return the in-order predecessor. More...
 
void remove (BinTreeNode *&x, BinTreeNode *&y)
 Remove the node from the tree. More...
 
BinTreeNoderight () const
 Return the right child. More...
 
const BinTreeNoderightMost () const
 Return the right-most child (largest node reachable from self). More...
 
BinTreeNoderightMost ()
 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...
 
BinTreeNodesibling () const
 Return the sibling node (nullptr if self is parent). More...
 

Detailed Description

Red/black tree node.

You shouldn't need to use this class directly.

Attributes

  • color : All nodes in a red/black tree are colored red or black.
Author
Adam McKee

Definition at line 29 of file RBtreeNode.h.

Member Enumeration Documentation

◆ color_t

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.

Member Function Documentation

◆ addFixup()

virtual void utl::RBtreeNode::addFixup ( )
virtual

Perform necessary re-balancing following the addition of a node.

Implements utl::BinTreeNode.

◆ removeFixup()

virtual void utl::RBtreeNode::removeFixup ( const BinTreeNode removedNode)
virtual

Perform re-balancing following the removal of a node.

Implements utl::BinTreeNode.

◆ swapWith()

virtual void utl::RBtreeNode::swapWith ( BinTreeNode rhs)
virtual

Trade places with the given node.

Reimplemented from utl::BinTreeNode.

◆ getColor()

uint_t utl::RBtreeNode::getColor ( ) const
inline

Get the color (RED or BLACK).

Definition at line 74 of file RBtreeNode.h.

◆ setColor()

void utl::RBtreeNode::setColor ( uint_t  color)
inline

Set the color (RED or BLACK).

Definition at line 81 of file RBtreeNode.h.

◆ sibling()

RBtreeNode* utl::RBtreeNode::sibling ( ) const
inline

Return self's sibling (nullptr if none).

Definition at line 88 of file RBtreeNode.h.


The documentation for this class was generated from the following file: