#include "CTBbtree.hxx"
Inheritance diagram for CTBbtreeNode:
Public Methods | |
CTBbtreeNode () | |
virtual | ~CTBbtreeNode () |
virtual CTBbtreeNode * | Clone () const |
CTBbtree * | Head () const |
CTBbtreeNode * | Left () const |
CTBbtreeNode * | Right () const |
CTBbtreeNode * | Up () const |
CTBbtreeNode * | Next () const |
CTBbtreeNode * | Prev () const |
CTBbtreeNode * | Skip (CTBint i_offset) const |
CTBint | Rank () const |
CTBint | LWeight () const |
bool | IsRNode () const |
bool | IsLeftChild () const |
bool | IsRightChild () const |
bool | IsBalanced () const |
bool | IsLeftHeavy () const |
bool | IsRightHeavy () const |
void | Insert (CTBbtree &head, CTBbtreeNode *p_parent, int i_ctype) |
void | Remove () |
Private Methods | |
void | LWeight (CTBint i_weight) |
void | IncLWeight () |
void | DecLWeight () |
void | SetRNode () |
void | SetLeftChild () |
void | SetRightChild () |
void | SetBalanced () |
void | SetLeftHeavy () |
void | SetRightHeavy () |
void | RotateLeft () |
void | RotateRight () |
void | RotateLeftRight () |
void | RotateRightLeft () |
void | InsertFixup () |
void | RemoveFixup () |
void | SubTreeHeight (int &i_minh, int &i_maxh, double &d_nnode, double &d_ncomp) const |
bool | SubTreeCheck (ostream *p_os, int &i_maxh) const |
CTBbtreeNode (const CTBbtreeNode &rhs) | |
CTBbtreeNode & | operator= (const CTBbtreeNode &rhs) |
Private Attributes | |
CTBbtree * | mp_head |
CTBbtreeNode * | mp_up |
CTBbtreeNode * | mp_left |
CTBbtreeNode * | mp_right |
CTBuint32 | mi_status |
Static Private Attributes | |
const CTBuint32 | status_lchild = 0x2 |
const CTBuint32 | status_rchild = 0x1 |
const CTBuint32 | status_childmask = status_lchild | status_rchild |
const CTBuint32 | status_lheavy = 0x8 |
const CTBuint32 | status_rheavy = 0x4 |
const CTBuint32 | status_heavymask = status_lheavy | status_rheavy |
const CTBuint32 | status_bitmask = status_childmask|status_heavymask |
const CTBuint32 | status_deltaw = 16 |
Friends | |
class | CTBbtree |
Definition at line 56 of file CTBbtree.hxx.
|
Default constructor.
Definition at line 71 of file CTBbtree.icc. Referenced by Clone().
|
|
Definition at line 399 of file CTBbtree.cxx. |
|
|
|
Returns the pointer to a new instantiation of return new T(*this); Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 418 of file CTBbtree.cxx. Referenced by CTBbtree::operator=().
|
|
Returns tree header or null of node is unconnected.
Definition at line 82 of file CTBbtree.icc. |
|
Returns left child of node (or null if none).
Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 90 of file CTBbtree.icc. Referenced by CTBmapNode::Left(), and CTBgsetNode::Left().
|
|
Returns right child of node (or null if none).
Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 98 of file CTBbtree.icc. Referenced by CTBmapNode::Right(), and CTBgsetNode::Right().
|
|
Returns parent node or null if in root node.
Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 106 of file CTBbtree.icc. Referenced by CTBmapNode::Up(), and CTBgsetNode::Up().
|
|
Returns pointer to next node (or null if in last).
Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 428 of file CTBbtree.cxx. Referenced by CTBbtree::Dump(), CTBmapNode::Next(), CTBgsetNode::Next(), Remove(), and Skip().
|
|
Returns pointer to previous node (or null if in last).
Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 461 of file CTBbtree.cxx. Referenced by CTBmapNode::Prev(), CTBgsetNode::Prev(), Remove(), and Skip().
|
|
Skip i_offset nodes. Returns the pointer to the node i_offset steps away from the current one. The function moves to the left (previous) if i_offset is < 0 and to the right is i_offset is > 0. A null is returned when the offset is too large.
This functions is substantially more efficient than a simple iteration of Reimplemented in CTBgsetNode, and CTBmapNode. Definition at line 499 of file CTBbtree.cxx. Referenced by CTBmapNode::Skip(), and CTBgsetNode::Skip().
|
|
Returns rank of node.
Definition at line 552 of file CTBbtree.cxx. Referenced by CTBmapBrowser::Rank(), and CTBgsetBrowser::Rank().
|
|
Returns weight of left subtree.
Definition at line 117 of file CTBbtree.icc. Referenced by CTBbtree::Dump(), Rank(), RotateLeft(), RotateRight(), Skip(), and CTBbtree::operator[]().
|
|
Returns true if node is root node.
Definition at line 125 of file CTBbtree.icc. Referenced by Remove(), RotateLeft(), RotateRight(), Skip(), and CTBbtree::operator=().
|
|
Returns true if node is a left child.
Definition at line 133 of file CTBbtree.icc. Referenced by CTBbtree::Clear(), CTBbtree::Dump(), InsertFixup(), Prev(), Remove(), RemoveFixup(), RotateLeft(), RotateRight(), Skip(), and CTBbtree::operator=().
|
|
Returns true if node is a right child.
Definition at line 141 of file CTBbtree.icc. Referenced by CTBbtree::Clear(), CTBbtree::Dump(), InsertFixup(), Next(), Rank(), Remove(), and Skip().
|
|
Returns true if left and right subtrees are balanced.
Definition at line 149 of file CTBbtree.icc. Referenced by InsertFixup(), RemoveFixup(), and SubTreeCheck().
|
|
Returns true if left subtree is one level higher than right subtree.
Definition at line 157 of file CTBbtree.icc. Referenced by CTBbtree::Dump(), InsertFixup(), RemoveFixup(), and SubTreeCheck().
|
|
Returns true if right subtree is one level higher than left subtree.
Definition at line 165 of file CTBbtree.icc. Referenced by CTBbtree::Dump(), InsertFixup(), RemoveFixup(), and SubTreeCheck().
|
|
Insert node into tree. The node is inserted in the tree given by header head as a child of the node p_parent. If i_ctype<0 the node will be inserted as left child, if i_ctype>0 as right child. If i_ctype==0 and p_parent==0 the node is inserted as root node. Definition at line 573 of file CTBbtree.cxx. Referenced by CTBmap::InsertNode(), and CTBgset::InsertNode().
|
|
Remove node from tree.
Definition at line 634 of file CTBbtree.cxx. Referenced by CTBmap::RemoveNode(), CTBgset::RemoveNode(), and ~CTBbtreeNode().
|
|
Definition at line 171 of file CTBbtree.icc. |
|
Definition at line 179 of file CTBbtree.icc. Referenced by InsertFixup().
|
|
Definition at line 186 of file CTBbtree.icc. Referenced by RemoveFixup().
|
|
Definition at line 193 of file CTBbtree.icc. |
|
Definition at line 200 of file CTBbtree.icc. Referenced by RotateLeft(), and RotateRight().
|
|
Definition at line 208 of file CTBbtree.icc. Referenced by RotateLeft(), and RotateRight().
|
|
Definition at line 216 of file CTBbtree.icc. Referenced by InsertFixup(), and RemoveFixup().
|
|
Definition at line 223 of file CTBbtree.icc. Referenced by InsertFixup(), and RemoveFixup().
|
|
Definition at line 230 of file CTBbtree.icc. Referenced by InsertFixup(), and RemoveFixup().
|
|
Single rotation, left.
The subtree below | | New weights: this-> B C / \ ==> / \ A' = A / \ B de B' = B A C / \ C' = C + B / \ / \ A ga al be ga de / \ al be Definition at line 719 of file CTBbtree.cxx. Referenced by InsertFixup(), RemoveFixup(), RotateLeftRight(), and RotateRightLeft().
|
|
Single rotation, right.
The subtree below | | New weights: this-> B A / \ ==> / \ A' = A / \ al B B' = B - A A C / \ C' = C / \ / \ be C al be ga de / \ ga de Definition at line 778 of file CTBbtree.cxx. Referenced by InsertFixup(), RemoveFixup(), RotateLeftRight(), and RotateRightLeft().
|
|
Double rotation, left-right.
Two rotations are performed on the subtree below
Definition at line 834 of file CTBbtree.cxx. Referenced by InsertFixup(), and RemoveFixup().
|
|
Double rotation, right-left.
Two rotations are performed on the subtree below
Definition at line 866 of file CTBbtree.cxx. Referenced by InsertFixup(), and RemoveFixup().
|
|
All fixup's after insertion.
Definition at line 882 of file CTBbtree.cxx. Referenced by Insert().
|
|
All fixup's after removal.
Definition at line 978 of file CTBbtree.cxx. Referenced by Remove().
|
|
Determine subtree properties. Scans the sub-tree and returns
Definition at line 1094 of file CTBbtree.cxx. Referenced by CTBbtree::TreeHeight().
|
|
Check whether subtree is balanced.
Definition at line 1140 of file CTBbtree.cxx. Referenced by CTBbtree::TreeCheck().
|
|
|
|
Definition at line 58 of file CTBbtree.hxx. |
|
Definition at line 131 of file CTBbtree.hxx. |
|
Definition at line 132 of file CTBbtree.hxx. |
|
Definition at line 133 of file CTBbtree.hxx. |
|
Definition at line 134 of file CTBbtree.hxx. |
|
Definition at line 135 of file CTBbtree.hxx. |
|
Definition at line 136 of file CTBbtree.hxx. |
|
Definition at line 137 of file CTBbtree.hxx. |
|
Definition at line 138 of file CTBbtree.hxx. |
|
tree header.
Definition at line 140 of file CTBbtree.hxx. |
|
up (parent).
Definition at line 141 of file CTBbtree.hxx. |
|
left child.
Definition at line 142 of file CTBbtree.hxx. |
|
right child.
Definition at line 143 of file CTBbtree.hxx. |
|
see Note 1.
Definition at line 144 of file CTBbtree.hxx. |