204 Error(
"Add",
"object must be sortable");
286 Error(
"FindObject",
"object must be sortable");
305 Error(
"IdxAdd",
"object must be sortable");
347 Warning(
"Init",
"order must be at least 3");
396 Error(
"Rank",
"object must be sortable");
411 Error(
"Remove",
"object must be sortable");
464 b.ReadVersion(&R__s, &R__c);
471 TSeqCollection::Streamer(
b);
472 b.CheckByteCount(R__s, R__c,TBtree::IsA());
474 R__c =
b.WriteVersion(TBtree::IsA(),
kTRUE);
481 TSeqCollection::Streamer(
b);
482 b.SetByteCount(R__c,
kTRUE);
578 : fTree(t), fCurCursor(0), fCursor(0), fDirection(dir)
643 if (fCursor < fTree->GetSize())
677 return (((
fCurCursor >= 0) && (fCurCursor < fTree->GetSize())) ?
693 ::Fatal(
"TBtInnerNode::TBtInnerNode",
"no more memory");
705 ::Fatal(
"TBtInnerNode::TBtInnerNode",
"no more memory");
784 for (
Int_t i = start; i <= stop; i++)
818 PushLeft(noFromThis, leftsib, pidx);
894 for (
Int_t i = 0; i <
l; i++)
987 Int_t hasLeftSib = (leafidx > 0) &&
995 }
else if (hasLeftSib) {
1002 }
else if (hasRightSib) {
1005 }
else if (leftSibFull) {
1008 }
else if (hasLeftSib) {
1023 Int_t hasLeftSib = (inneridx > 0) &&
1030 }
else if (hasLeftSib) {
1036 }
else if (hasRightSib) {
1038 }
else if (leftSibFull) {
1040 }
else if (hasLeftSib) {
1066 Int_t hasLeftSib = (leafidx > 0) &&
1076 }
else if (hasLeftSib) {
1079 }
else if (hasRightSib) {
1092 Int_t hasLeftSib = (inneridx > 0) &&
1100 }
else if (hasLeftSib) {
1102 }
else if (hasRightSib) {
1124 if (rightsib->
Psize() > 0)
1155 ::Error(
"TBtInnerNode::operator[]",
"should not happen, 0 returned");
1162 ::Error(
"TBtInnerNode::operator[]",
"should not happen, 0 returned");
1200 tgt = rightsib->
fLast + noFromThis;
1201 src = rightsib->
fLast;
1202 rightsib->
fLast = tgt;
1223 fLast -= noFromThis;
1322 Int_t newSizeThis = nofKeys / 3;
1323 Int_t newSizeNew = (nofKeys - newSizeThis) / 2;
1324 Int_t newSizeSib = (nofKeys - newSizeThis - newSizeNew);
1326 Int_t noFromSib = rightsib->
Vsize() - newSizeSib;
1335 if (noFromThis > 0) {
1339 this->
PushRight(noFromThis-1, newNode, keyidx);
1340 rightsib->
PushLeft(noFromSib, newNode, keyidx+1);
1347 rightsib->
PushLeft(noFromSib-1, newNode, keyidx+1);
1433 for (
Int_t i = start; i <= stop; i++)
1457 PushLeft(noFromThis, leftsib, pidx);
1536 if (
fItem[i] == that)
1628 tgt = rightsib->
fLast + noFromThis;
1629 src = rightsib->
fLast;
1630 rightsib->
fLast = tgt;
1632 rightsib->
fItem[tgt--] = rightsib->
fItem[src--];
1646 fLast -= noFromThis;
1711 Int_t newSizeThis = nofKeys / 3;
1712 Int_t newSizeNew = (nofKeys - newSizeThis) / 2;
1713 Int_t newSizeSib = (nofKeys - newSizeThis - newSizeNew);
1715 Int_t noFromSib = rightsib->
Vsize() - newSizeSib;
1723 this->
PushRight(noFromThis-1, newNode, keyidx);
1724 rightsib->
PushLeft(noFromSib, newNode, keyidx+1);
const Bool_t kIterForward
void Error(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
Int_t Compare(const void *item1, const void *item2)
Int_t DecNofKeys(Int_t i, Int_t n=1)
void InformParent()
Tell the parent that we are full.
void ShiftLeft(Int_t cnt)
Shift to the left.
TBtLeafNode * LastLeafNode()
Return the last leaf node.
void BalanceWithLeft(TBtInnerNode *l, Int_t idx)
THIS has more than LEFTSIB.
Int_t IncNofKeys(Int_t i, Int_t n=1)
void BalanceWithRight(TBtInnerNode *r, Int_t idx)
THIS has more than RIGHTSIB.
Int_t FindRankUp(const TBtNode *n) const
FindRankUp is FindRank in reverse.
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 ne...
void Append(TObject *obj, TBtNode *n)
Never called from anywhere where it might fill up THIS.
void Add(const TObject *obj, Int_t idx)
This is called only from TBtree::Add().
TBtItem & GetItem(Int_t i) const
void SetKey(Int_t i, TObject *obj)
Int_t GetNofKeys(Int_t i) const
void AddElt(TBtItem &itm, Int_t at)
Add one element.
Int_t IndexOf(const TBtNode *n) const
Returns a number in the range 0 to this->fLast 0 is returned if THAT == fTree[0].
void MergeWithRight(TBtInnerNode *r, Int_t idx)
Merge the 2 part of the tree.
TBtLeafNode * FirstLeafNode()
Return the first leaf node.
Int_t IsAlmostFull() const
void SetItem(Int_t i, TBtItem &itm)
void SetNofKeys(Int_t i, Int_t r)
TObject * operator[](Int_t i) const
return an element.
void SetTree(Int_t i, TBtNode *node)
Int_t FindRank(const TObject *obj) const
Recursively look for WHAT starting in the current node.
void Remove(Int_t idx)
Remove an element.
Int_t NofKeys() const
Number of key.
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 ...
void IncrNofKeys(TBtNode *np)
THAT is a child of THIS that has just grown by 1.
TObject * GetKey(Int_t i) const
void DecrNofKeys(TBtNode *np)
THAT is a child of THIS that has just shrunk by 1.
void Split()
This function is called only when THIS is the only descendent of the root node, and THIS needs to be ...
~TBtInnerNode()
Constructor.
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 ...
void PushRight(Int_t cnt, TBtInnerNode *rightsib, Int_t parentIdx)
The operation is three steps:
TBtNode * GetTree(Int_t i) const
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...
TObject * Found(const TObject *obj, TBtNode **which, Int_t *where)
Recursively look for WHAT starting in the current node.
void RemoveItem(Int_t idx)
Remove an item.
Int_t NofKeys(Int_t idx) const
Item stored in inner nodes of a TBtree.
~TBtItem()
Delete a tree item.
void BalanceWith(TBtLeafNode *n, Int_t idx)
PITEM is the parent item whose key will change when keys are shifted from one LeafNode to the other.
void BalanceWithRight(TBtLeafNode *r, Int_t idx)
THIS has more than RIGHTSIB; move some items from THIS to RIGHTSIB.
Int_t IsAlmostFull() const
void RemoveItem(Int_t idx)
Int_t NofKeys() const
Return the number of keys.
void ShiftLeft(Int_t cnt)
Shift.
void PushRight(Int_t cnt, TBtLeafNode *r, Int_t parentIndex)
noFromThis==1 => moves the parent item into the rightsib, and the last item in this's array into the ...
void SplitWith(TBtLeafNode *r, Int_t idx)
Split.
void Add(const TObject *obj, Int_t idx)
Add the object OBJ to the leaf node, inserting it at location INDEX in the fItem array.
void BalanceWithLeft(TBtLeafNode *l, Int_t idx)
THIS has more than LEFTSIB; move some items from THIS to LEFTSIB.
void PushLeft(Int_t cnt, TBtLeafNode *l, Int_t parentIndex)
noFromThis==1 => moves the parent item into the leftsib, and the first item in this's array into the ...
Int_t FindRank(const TObject *obj) const
WHAT was not in any inner node; it is either here, or it's not in the tree.
TBtLeafNode * LastLeafNode()
return the last node.
void MergeWithRight(TBtLeafNode *r, Int_t idx)
Merge.
~TBtLeafNode()
Destructor.
TObject * Found(const TObject *obj, TBtNode **which, Int_t *where)
WHAT was not in any inner node; it is either here, or it's not in the tree.
TBtLeafNode * FirstLeafNode()
Return the first node.
Int_t NofKeys(Int_t i) const
Return the number of keys.
void Remove(Int_t idx)
Remove an element.
void Split()
This function is called only when THIS is the only descendent of the root node, and THIS needs to be ...
void Append(TObject *obj)
Never called from anywhere where it might fill up THIS does NOT handle nofKeys.
Int_t IndexOf(const TObject *obj) const
Returns a number in the range 0 to MaxIndex().
void AppendFrom(TBtLeafNode *src, Int_t start, Int_t stop)
A convenience function, does not worry about the element in the parent, simply moves elements from SR...
Abstract base class (ABC) of a TBtree node.
virtual void Add(const TObject *obj, Int_t index)=0
virtual TBtLeafNode * LastLeafNode()=0
virtual Int_t FindRank(const TObject *obj) const =0
virtual ~TBtNode()
Delete a B-tree node.
virtual Int_t NofKeys() const =0
friend class TBtInnerNode
TBtNode(Int_t isleaf, TBtInnerNode *p, TBtree *t=0)
Create a B-tree node.
virtual TBtree * GetParentTree() const
virtual void Remove(Int_t index)=0
virtual TBtLeafNode * FirstLeafNode()=0
virtual TObject * Found(const TObject *obj, TBtNode **which, Int_t *where)=0
void Reset()
Reset the B-tree iterator.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
TObject * operator*() const
Return current object or nullptr.
TObject * Next()
Get next object from B-tree. Returns 0 when no more objects in tree.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
void Add(TObject *obj)
Add object to B-tree.
Int_t IdxAdd(const TObject &obj)
Add object and return its index in the tree.
Int_t Rank(const TObject *obj) const
Returns the rank of the object in the tree.
void Delete(Option_t *option="")
Remove all objects from B-tree AND delete all heap based objects.
virtual ~TBtree()
Delete B-tree.
void Init(Int_t i)
Initialize a B-tree.
TObject * Before(const TObject *obj) const
May not use this method since B-tree decides order.
void Clear(Option_t *option="")
Remove all objects from B-tree.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns a B-tree iterator.
friend class TBtInnerNode
void RootIsFull()
The root of the tree is full.
TBtree(Int_t ordern=3)
Create a B-tree of certain order (by default 3).
TObject * Remove(TObject *obj)
Remove an object from the tree.
TObject * After(const TObject *obj) const
Cannot use this method since B-tree decides order.
TObject * At(Int_t idx) const
TObject * FindObject(const char *name) const
Find object using its name (see object's GetName()).
void RootIsEmpty()
If root is empty clean up its space.
Buffer base class used for serializing objects.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Bool_t IsArgNull(const char *where, const TObject *obj) const
Returns true if object is a null pointer.
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Iterator abstract base class.
Mother of all ROOT objects.
virtual Bool_t IsSortable() const
R__ALWAYS_INLINE Bool_t IsOnHeap() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static long int sum(long int i)