ROOT 6.12/07 Reference Guide |
Public Member Functions | |
TBtInnerNode (TBtInnerNode *parent, TBtree *t=0) | |
Create a B-tree innernode. More... | |
TBtInnerNode (TBtInnerNode *parent, TBtree *tree, TBtNode *oldroot) | |
Called only by TBtree to initialize the TBtInnerNode that is about to become the root. More... | |
~TBtInnerNode () | |
Constructor. More... | |
void | Add (const TObject *obj, Int_t idx) |
This is called only from TBtree::Add(). More... | |
void | Add (TBtItem &i, Int_t idx) |
Add one element. More... | |
void | Add (Int_t at, TObject *obj, TBtNode *n) |
Add one element. More... | |
void | AddElt (TBtItem &itm, Int_t at) |
Add one element. More... | |
void | AddElt (Int_t at, TObject *obj, TBtNode *n) |
Add one element. More... | |
void | Append (TObject *obj, TBtNode *n) |
Never called from anywhere where it might fill up THIS. More... | |
void | Append (TBtItem &itm) |
Append itm to this tree. More... | |
void | AppendFrom (TBtInnerNode *src, Int_t start, Int_t stop) |
This should never create a full node that is, it is not used anywhere where THIS could possibly be near full. More... | |
void | BalanceWith (TBtInnerNode *n, int idx) |
PINDX is the index of the parent item whose key will change when keys are shifted from one InnerNode to the other. More... | |
void | BalanceWithLeft (TBtInnerNode *l, Int_t idx) |
THIS has more than LEFTSIB. More... | |
void | BalanceWithRight (TBtInnerNode *r, Int_t idx) |
THIS has more than RIGHTSIB. More... | |
Int_t | DecNofKeys (Int_t i, Int_t n=1) |
void | DecrNofKeys (TBtNode *np) |
THAT is a child of THIS that has just shrunk by 1. More... | |
Int_t | FindRank (const TObject *obj) const |
Recursively look for WHAT starting in the current node. More... | |
Int_t | FindRankUp (const TBtNode *n) const |
FindRankUp is FindRank in reverse. More... | |
TBtLeafNode * | FirstLeafNode () |
Return the first leaf node. More... | |
TObject * | Found (const TObject *obj, TBtNode **which, Int_t *where) |
Recursively look for WHAT starting in the current node. More... | |
TBtItem & | GetItem (Int_t i) const |
TObject * | GetKey (Int_t i) const |
Int_t | GetNofKeys (Int_t i) const |
TBtNode * | GetTree (Int_t i) const |
Int_t | IncNofKeys (Int_t i, Int_t n=1) |
void | IncrNofKeys (TBtNode *np) |
THAT is a child of THIS that has just grown by 1. More... | |
Int_t | IndexOf (const TBtNode *n) const |
Returns a number in the range 0 to this->fLast 0 is returned if THAT == fTree[0]. More... | |
void | InformParent () |
Tell the parent that we are full. More... | |
Int_t | IsAlmostFull () const |
Int_t | IsFull () const |
void | IsFull (TBtNode *n) |
The child node THAT is full. More... | |
Int_t | IsLow () const |
void | IsLow (TBtNode *n) |
The child node THAT is <= half full. More... | |
TBtLeafNode * | LastLeafNode () |
Return the last leaf node. More... | |
Int_t | MaxIndex () const |
Int_t | MaxPsize () const |
void | MergeWithRight (TBtInnerNode *r, Int_t idx) |
Merge the 2 part of the tree. More... | |
Int_t | NofKeys (Int_t idx) const |
Int_t | NofKeys () const |
Number of key. More... | |
TObject * | operator[] (Int_t i) const |
return an element. More... | |
Int_t | Psize () const |
void | PushLeft (Int_t cnt, TBtInnerNode *leftsib, Int_t parentIdx) |
noFromThis==1 => moves the parent item into the leftsib, and the first item in this's array into the parent item. More... | |
void | PushRight (Int_t cnt, TBtInnerNode *rightsib, Int_t parentIdx) |
The operation is three steps: More... | |
void | Remove (Int_t idx) |
Remove an element. More... | |
void | RemoveItem (Int_t idx) |
Remove an item. More... | |
void | SetItem (Int_t i, TBtItem &itm) |
void | SetItem (Int_t i, TObject *obj, TBtNode *node) |
void | SetKey (Int_t i, TObject *obj) |
void | SetNofKeys (Int_t i, Int_t r) |
void | SetTree (Int_t i, TBtNode *node) |
void | ShiftLeft (Int_t cnt) |
Shift to the left. More... | |
void | Split () |
This function is called only when THIS is the only descendent of the root node, and THIS needs to be split. More... | |
void | SplitWith (TBtInnerNode *r, Int_t idx) |
THIS and SIB are too full; create a NEWNODE, and balance the number of keys between the three of them. More... | |
Int_t | Vsize () const |
Public Member Functions inherited from TBtNode | |
TBtNode (Int_t isleaf, TBtInnerNode *p, TBtree *t=0) | |
Create a B-tree node. More... | |
virtual | ~TBtNode () |
Delete a B-tree node. More... | |
virtual TBtree * | GetParentTree () const |
Private Attributes | |
TBtItem * | fItem |
Additional Inherited Members | |
Protected Attributes inherited from TBtNode | |
Int_t | fIsLeaf |
Int_t | fLast |
TBtInnerNode * | fParent |
TBtree * | fTree |
#include <TBtree.h>
TBtInnerNode::TBtInnerNode | ( | TBtInnerNode * | parent, |
TBtree * | t = 0 |
||
) |
Create a B-tree innernode.
Definition at line 688 of file TBtree.cxx.
TBtInnerNode::TBtInnerNode | ( | TBtInnerNode * | parent, |
TBtree * | tree, | ||
TBtNode * | oldroot | ||
) |
Called only by TBtree to initialize the TBtInnerNode that is about to become the root.
Definition at line 700 of file TBtree.cxx.
TBtInnerNode::~TBtInnerNode | ( | ) |
Constructor.
Definition at line 712 of file TBtree.cxx.
This is called only from TBtree::Add().
Implements TBtNode.
Definition at line 725 of file TBtree.cxx.
Add one element.
Definition at line 757 of file TBtree.cxx.
Add one element.
Definition at line 767 of file TBtree.cxx.
Add one element.
Definition at line 735 of file TBtree.cxx.
Add one element.
Definition at line 748 of file TBtree.cxx.
Never called from anywhere where it might fill up THIS.
Definition at line 791 of file TBtree.cxx.
Append itm to this tree.
Definition at line 801 of file TBtree.cxx.
void TBtInnerNode::AppendFrom | ( | TBtInnerNode * | src, |
Int_t | start, | ||
Int_t | stop | ||
) |
This should never create a full node that is, it is not used anywhere where THIS could possibly be near full.
Definition at line 777 of file TBtree.cxx.
void TBtInnerNode::BalanceWith | ( | TBtInnerNode * | rightsib, |
int | idx | ||
) |
PINDX is the index of the parent item whose key will change when keys are shifted from one InnerNode to the other.
Definition at line 839 of file TBtree.cxx.
void TBtInnerNode::BalanceWithLeft | ( | TBtInnerNode * | leftsib, |
Int_t | pidx | ||
) |
THIS has more than LEFTSIB.
Move some item from THIS to LEFTSIB. PIDX is the index of the parent item that will change when keys are moved.
Definition at line 812 of file TBtree.cxx.
void TBtInnerNode::BalanceWithRight | ( | TBtInnerNode * | rightsib, |
Int_t | pidx | ||
) |
THIS has more than RIGHTSIB.
Move some items from THIS to RIGHTSIB. PIDX is the index of the parent item that will change when keys are moved.
Definition at line 826 of file TBtree.cxx.
THAT is a child of THIS that has just shrunk by 1.
Definition at line 850 of file TBtree.cxx.
Recursively look for WHAT starting in the current node.
Implements TBtNode.
Definition at line 863 of file TBtree.cxx.
FindRankUp is FindRank in reverse.
Whereas FindRank looks for the object and computes the rank along the way while walking DOWN the tree, FindRankUp already knows where the object is and has to walk UP the tree from the object to compute the rank.
Definition at line 890 of file TBtree.cxx.
|
virtual |
Recursively look for WHAT starting in the current node.
Implements TBtNode.
Definition at line 910 of file TBtree.cxx.
THAT is a child of THIS that has just grown by 1.
Definition at line 932 of file TBtree.cxx.
Returns a number in the range 0 to this->fLast 0 is returned if THAT == fTree[0].
Definition at line 946 of file TBtree.cxx.
void TBtInnerNode::InformParent | ( | ) |
Tell the parent that we are full.
Definition at line 958 of file TBtree.cxx.
The child node THAT is full.
We will either redistribute elements or create a new node and then redistribute. In an attempt to minimize the number of splits, we adopt the following strategy:
Definition at line 977 of file TBtree.cxx.
The child node THAT is <= half full.
We will either redistribute elements between children, or THAT will be merged with another child. In an attempt to minimize the number of mergers, we adopt the following strategy:
Definition at line 1056 of file TBtree.cxx.
|
virtual |
void TBtInnerNode::MergeWithRight | ( | TBtInnerNode * | r, |
Int_t | idx | ||
) |
Merge the 2 part of the tree.
Definition at line 1121 of file TBtree.cxx.
|
virtual |
void TBtInnerNode::PushLeft | ( | Int_t | noFromThis, |
TBtInnerNode * | leftsib, | ||
Int_t | pidx | ||
) |
noFromThis==1 => moves the parent item into the leftsib, and the first item in this's array into the parent item.
Definition at line 1170 of file TBtree.cxx.
void TBtInnerNode::PushRight | ( | Int_t | noFromThis, |
TBtInnerNode * | rightsib, | ||
Int_t | pidx | ||
) |
The operation is three steps:
Definition at line 1189 of file TBtree.cxx.
Remove an item.
Definition at line 1244 of file TBtree.cxx.
Shift to the left.
Definition at line 1263 of file TBtree.cxx.
|
virtual |
This function is called only when THIS is the only descendent of the root node, and THIS needs to be split.
Assumes that idx of THIS in fParent is 0.
Implements TBtNode.
Definition at line 1277 of file TBtree.cxx.
void TBtInnerNode::SplitWith | ( | TBtInnerNode * | rightsib, |
Int_t | keyidx | ||
) |
THIS and SIB are too full; create a NEWNODE, and balance the number of keys between the three of them.
picture: (also see Knuth Vol 3 pg 478)
keyidx is the index of where the sibling is, and where the newly created node will be recorded (sibling will be moved to keyidx+1)
Definition at line 1316 of file TBtree.cxx.