ORIGINAL
|
Internal node class for Red-Black Tree. More...
#include <RBTree.h>
Public Types | |
enum class | color { BLACK , RED } |
Node color enumeration. | |
Public Member Functions | |
RBNode (const K_TYPE &key=K_TYPE{}, const V_TYPE &value=V_TYPE{}, color color=color::RED, RBNode *parent=nullptr, RBNode *left=nullptr, RBNode *right=nullptr) | |
Constructs a new RBNode. | |
RBNode (const RBNode &other) | |
Copy constructor. | |
RBNode & | operator= (const RBNode &other) |
Copy assignment operator. | |
RBNode (RBNode &&other) noexcept | |
Move constructor. | |
void | swapData (RBNode &other) noexcept |
Swaps data with another node. | |
void | swapColor (RBNode &other) noexcept |
Swaps color with another node. | |
couple< const K_TYPE, V_TYPE > & | getVal () |
Gets key-value pair (non-const) | |
const couple< const K_TYPE, V_TYPE > & | getVal () const |
Gets key-value pair (const) | |
const K_TYPE & | getKey () const |
Gets key. | |
const V_TYPE & | getValue () const |
Gets value (const) | |
V_TYPE & | getValue () |
Gets value (non-const) | |
void | setValue (const V_TYPE &value) |
Sets new value. | |
color | getColor () const |
Gets node color. | |
RBNode * | getPParent () const |
Gets parent node. | |
RBNode * | getPLeft () const |
Gets left child. | |
RBNode * | getPRight () const |
Gets right child. | |
RBNode *& | getPLeftRef () |
Gets left child reference. | |
RBNode *& | getPRightRef () |
Gets right child reference. | |
void | setColor (color new_color) |
Sets node color. | |
void | setPParent (RBNode *new_parent) |
Sets parent node. | |
void | setPLeft (RBNode *new_left) |
Sets left child. | |
void | setPRight (RBNode *new_right) |
Sets right child. | |
Static Public Member Functions | |
static void | connect (RBNode *parent, RBNode *child, bool is_left) |
Connects parent and child nodes. | |
Internal node class for Red-Black Tree.
Represents a single node in the tree with:
|
explicit |
Constructs a new RBNode.
key | Key to store |
value | Value to store |
color | Initial color (default: RED) |
parent | Parent node (default: nullptr) |
left | Left child (default: nullptr) |
right | Right child (default: nullptr) |
|
static |
Connects parent and child nodes.
parent | Parent node |
child | Child node |
is_left | Whether child is left child |
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::color original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getColor | ( | ) | const |
Gets node color.
const K_TYPE & original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getKey | ( | ) | const |
Gets key.
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode * original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getPLeft | ( | ) | const |
Gets left child.
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode *& original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getPLeftRef | ( | ) |
Gets left child reference.
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode * original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getPParent | ( | ) | const |
Gets parent node.
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode * original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getPRight | ( | ) | const |
Gets right child.
original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode *& original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getPRightRef | ( | ) |
Gets right child reference.
original::couple< const K_TYPE, V_TYPE > & original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getVal | ( | ) |
Gets key-value pair (non-const)
const original::couple< const K_TYPE, V_TYPE > & original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getVal | ( | ) | const |
Gets key-value pair (const)
V_TYPE & original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getValue | ( | ) |
Gets value (non-const)
const V_TYPE & original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::getValue | ( | ) | const |
Gets value (const)
void original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::setColor | ( | color | new_color | ) |
Sets node color.
new_color | New color to set |
void original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::setPLeft | ( | RBNode * | new_left | ) |
Sets left child.
new_left | New left child to set |
void original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::setPParent | ( | RBNode * | new_parent | ) |
Sets parent node.
new_parent | New parent to set |
void original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::setPRight | ( | RBNode * | new_right | ) |
Sets right child.
new_right | New right child to set |
void original::RBTree< K_TYPE, V_TYPE, ALLOC, Compare >::RBNode::setValue | ( | const V_TYPE & | value | ) |
Sets new value.
value | New value to set |
|
noexcept |
Swaps color with another node.
other | Node to swap with |
|
noexcept |
Swaps data with another node.
other | Node to swap with |