ROOT
6.07/01
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 | Remove (Int_t idx) |
Remove an element. More... | |
void | RemoveItem (Int_t idx) |
Remove an item. More... | |
TObject * | operator[] (Int_t i) const |
return an element. More... | |
TObject * | Found (const TObject *obj, TBtNode **which, Int_t *where) |
Recursively look for WHAT starting in the current node. More... | |
Int_t | NofKeys (Int_t idx) const |
Int_t | NofKeys () const |
Number of key. More... | |
void | SetTree (Int_t i, TBtNode *node) |
void | SetKey (Int_t i, TObject *obj) |
void | SetItem (Int_t i, TBtItem &itm) |
void | SetItem (Int_t i, TObject *obj, TBtNode *node) |
Int_t | GetNofKeys (Int_t i) const |
void | SetNofKeys (Int_t i, Int_t r) |
Int_t | IncNofKeys (Int_t i, Int_t n=1) |
Int_t | DecNofKeys (Int_t i, Int_t n=1) |
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... | |
TBtNode * | GetTree (Int_t i) const |
TObject * | GetKey (Int_t i) const |
TBtItem & | GetItem (Int_t i) const |
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 | IncrNofKeys (TBtNode *np) |
THAT is a child of THIS that has just grown by 1. More... | |
void | DecrNofKeys (TBtNode *np) |
THAT is a child of THIS that has just shrunk by 1. More... | |
TBtLeafNode * | FirstLeafNode () |
Return the first leaf node. More... | |
TBtLeafNode * | LastLeafNode () |
Return the last leaf node. More... | |
void | InformParent () |
Tell the parent that we are full. 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... | |
void | MergeWithRight (TBtInnerNode *r, Int_t idx) |
Merge the 2 part of the tree. 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... | |
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 | 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 | 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 | 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 | ShiftLeft (Int_t cnt) |
Shift to the left. More... | |
Int_t | Psize () const |
Int_t | Vsize () const |
Int_t | MaxIndex () const |
Int_t | MaxPsize () const |
Int_t | IsFull () const |
void | IsFull (TBtNode *n) |
The child node THAT is full. More... | |
Int_t | IsAlmostFull () const |
Int_t | IsLow () const |
void | IsLow (TBtNode *n) |
The child node THAT is <= half full. More... | |
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 | fLast |
TBtInnerNode * | fParent |
TBtree * | fTree |
Int_t | fIsLeaf |
#include <TBtree.h>
TBtInnerNode::TBtInnerNode | ( | TBtInnerNode * | parent, |
TBtree * | t = 0 |
||
) |
Create a B-tree innernode.
Definition at line 687 of file TBtree.cxx.
Referenced by Split(), and SplitWith().
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 699 of file TBtree.cxx.
TBtInnerNode::~TBtInnerNode | ( | ) |
Constructor.
Definition at line 711 of file TBtree.cxx.
This is called only from TBtree::Add().
Implements TBtNode.
Definition at line 724 of file TBtree.cxx.
Referenced by Add().
Add one element.
Definition at line 756 of file TBtree.cxx.
Add one element.
Definition at line 766 of file TBtree.cxx.
Add one element.
Definition at line 734 of file TBtree.cxx.
Referenced by Add(), AddElt(), SplitWith(), and TBtLeafNode::SplitWith().
Add one element.
Definition at line 747 of file TBtree.cxx.
Never called from anywhere where it might fill up THIS.
Definition at line 790 of file TBtree.cxx.
Referenced by Split(), TBtLeafNode::Split(), SplitWith(), and TBtInnerNode().
Append itm to this tree.
Definition at line 800 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 776 of file TBtree.cxx.
Referenced by MergeWithRight(), PushLeft(), and Split().
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 838 of file TBtree.cxx.
Referenced by IsLow().
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 811 of file TBtree.cxx.
Referenced by BalanceWith(), and IsFull().
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 825 of file TBtree.cxx.
Referenced by BalanceWith(), IsFull(), and Split().
Definition at line 414 of file TBtree.h.
Referenced by PushRight(), Split(), and TBtLeafNode::SplitWith().
THAT is a child of THIS that has just shrunk by 1.
Definition at line 849 of file TBtree.cxx.
Referenced by DecrNofKeys(), and TBtLeafNode::Remove().
Recursively look for WHAT starting in the current node.
Implements TBtNode.
Definition at line 862 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 889 of file TBtree.cxx.
Referenced by FindRankUp(), and TBtree::IdxAdd().
|
virtual |
Recursively look for WHAT starting in the current node.
Implements TBtNode.
Definition at line 909 of file TBtree.cxx.
Definition at line 226 of file TBtree.h.
Referenced by AddElt(), AppendFrom(), PushRight(), ShiftLeft(), and SplitWith().
Definition at line 225 of file TBtree.h.
Referenced by FindRank(), Found(), MergeWithRight(), TBtLeafNode::MergeWithRight(), operator[](), PushLeft(), TBtLeafNode::PushLeft(), PushRight(), TBtLeafNode::PushRight(), Split(), and SplitWith().
Definition at line 393 of file TBtree.h.
Referenced by FindRank(), FindRankUp(), MergeWithRight(), NofKeys(), operator[](), and Split().
Definition at line 224 of file TBtree.h.
Referenced by Add(), BalanceWithLeft(), BalanceWithRight(), FindRank(), FirstLeafNode(), Found(), TBtree::IdxAdd(), IndexOf(), IsFull(), IsLow(), LastLeafNode(), operator[](), PushLeft(), TBtLeafNode::PushLeft(), PushRight(), TBtLeafNode::PushRight(), Remove(), TBtree::RootIsEmpty(), TBtLeafNode::Split(), Vsize(), and TBtLeafNode::Vsize().
Definition at line 409 of file TBtree.h.
Referenced by MergeWithRight(), PushRight(), and Split().
THAT is a child of THIS that has just grown by 1.
Definition at line 931 of file TBtree.cxx.
Referenced by TBtLeafNode::Add(), and IncrNofKeys().
Returns a number in the range 0 to this->fLast 0 is returned if THAT == fTree[0].
Definition at line 945 of file TBtree.cxx.
Referenced by DecrNofKeys(), FindRankUp(), IncrNofKeys(), IsFull(), and IsLow().
void TBtInnerNode::InformParent | ( | ) |
Tell the parent that we are full.
Definition at line 957 of file TBtree.cxx.
Referenced by Add(), SplitWith(), and TBtLeafNode::SplitWith().
|
inline |
|
inline |
Definition at line 257 of file TBtree.h.
Referenced by Add(), TBtLeafNode::Add(), InformParent(), SplitWith(), and TBtLeafNode::SplitWith().
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 976 of file TBtree.cxx.
|
inline |
Definition at line 260 of file TBtree.h.
Referenced by TBtLeafNode::Remove(), and RemoveItem().
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 1055 of file TBtree.cxx.
|
virtual |
|
inline |
Definition at line 252 of file TBtree.h.
Referenced by AddElt(), Append(), AppendFrom(), IsAlmostFull(), IsFull(), MergeWithRight(), and TBtInnerNode().
|
inline |
Definition at line 253 of file TBtree.h.
Referenced by IsLow(), PushLeft(), and PushRight().
void TBtInnerNode::MergeWithRight | ( | TBtInnerNode * | r, |
Int_t | idx | ||
) |
Definition at line 399 of file TBtree.h.
Referenced by PushLeft(), PushRight(), and SplitWith().
|
virtual |
Number of key.
Implements TBtNode.
Definition at line 1135 of file TBtree.cxx.
Referenced by PushLeft(), PushRight(), and SplitWith().
|
inline |
Definition at line 250 of file TBtree.h.
Referenced by BalanceWith(), BalanceWithLeft(), BalanceWithRight(), IsLow(), MergeWithRight(), NofKeys(), PushLeft(), PushRight(), RemoveItem(), TBtree::RootIsEmpty(), SplitWith(), and Vsize().
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 1169 of file TBtree.cxx.
Referenced by BalanceWithLeft(), MergeWithRight(), and SplitWith().
void TBtInnerNode::PushRight | ( | Int_t | noFromThis, |
TBtInnerNode * | rightsib, | ||
Int_t | pidx | ||
) |
The operation is three steps:
Definition at line 1188 of file TBtree.cxx.
Referenced by BalanceWithRight(), and SplitWith().
Remove an item.
Definition at line 1243 of file TBtree.cxx.
Referenced by MergeWithRight(), and TBtLeafNode::MergeWithRight().
Definition at line 216 of file TBtree.h.
Referenced by AddElt(), Append(), AppendFrom(), and PushRight().
Definition at line 215 of file TBtree.h.
Referenced by MergeWithRight(), PushLeft(), TBtLeafNode::PushLeft(), PushRight(), TBtLeafNode::PushRight(), Remove(), SetItem(), and SplitWith().
Definition at line 404 of file TBtree.h.
Referenced by TBtLeafNode::MergeWithRight(), PushLeft(), TBtLeafNode::PushLeft(), PushRight(), TBtLeafNode::PushRight(), TBtLeafNode::Split(), SplitWith(), and TBtLeafNode::SplitWith().
Definition at line 214 of file TBtree.h.
Referenced by SetItem(), and SplitWith().
Shift to the left.
Definition at line 1262 of file TBtree.cxx.
Referenced by PushLeft(), and SplitWith().
|
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 1276 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 1315 of file TBtree.cxx.
Referenced by IsFull().
|
inline |
Definition at line 419 of file TBtree.h.
Referenced by BalanceWith(), BalanceWithLeft(), BalanceWithRight(), IsLow(), MergeWithRight(), and SplitWith().
|
private |
Definition at line 193 of file TBtree.h.
Referenced by DecNofKeys(), DecrNofKeys(), GetItem(), GetKey(), GetNofKeys(), GetTree(), IncNofKeys(), IncrNofKeys(), RemoveItem(), SetItem(), SetKey(), SetNofKeys(), SetTree(), TBtInnerNode(), and ~TBtInnerNode().