26 #ifndef ROOT_TSeqCollection
150 virtual void Split() = 0;
339 public std::iterator<std::bidirectional_iterator_tag,
340 TObject*, std::ptrdiff_t,
341 const TObject**, const TObject*&> {
411 return (
fItem[i].fNofKeysInTree += n);
416 return (
fItem[i].fNofKeysInTree -= n);
TBtLeafNode(TBtInnerNode *p, const TObject *obj=0, TBtree *t=0)
Constructor.
void SetItem(Int_t i, TBtItem &itm)
TObject * At(Int_t idx) const
void BalanceWithLeft(TBtLeafNode *l, Int_t idx)
THIS has more than LEFTSIB; move some items from THIS to LEFTSIB.
void InformParent()
Tell the parent that we are full.
void SetKey(Int_t idx, TObject *obj)
Int_t FindRankUp(const TBtNode *n) const
FindRankUp is FindRank in reverse.
void SetItem(Int_t i, TObject *obj, TBtNode *node)
void ShiftLeft(Int_t cnt)
Shift.
void AddLast(TObject *obj)
Int_t DecNofKeys(Int_t i, Int_t n=1)
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...
~TBtItem()
Delete a tree item.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns a B-tree iterator.
void SetNofKeys(Int_t i, Int_t r)
TBtInnerNode(TBtInnerNode *parent, TBtree *t=0)
Create a B-tree innernode.
Int_t IsAlmostFull() const
TObject * operator[](Int_t i) const
void RemoveItem(Int_t idx)
void Add(TObject *obj)
Add object to B-tree.
virtual ~TBtree()
Delete B-tree.
Abstract base class (ABC) of a TBtree node.
TBtLeafNode * FirstLeafNode()
Return the first node.
void AddAfter(const TObject *, TObject *obj)
virtual TObject * operator[](Int_t i) const =0
void RootIsEmpty()
If root is empty clean up its space.
void Clear(Option_t *option="")
Remove all objects from B-tree.
virtual TObject * Found(const TObject *obj, TBtNode **which, Int_t *where)=0
virtual ~TBtNode()
Delete a B-tree node.
TObject * After(const TObject *obj) const
Cannot use this method since B-tree decides order.
void BalanceWithRight(TBtInnerNode *r, Int_t idx)
THIS has more than RIGHTSIB.
Int_t IdxAdd(const TObject &obj)
Add object and return its index in the tree.
Iterator abstract base class.
void AddElt(TBtItem &itm, Int_t at)
Add one element.
Int_t NofKeys() const
Return the number of keys.
virtual void Add(const TObject *obj, Int_t index)=0
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 p...
Int_t FindRank(const TObject *obj) const
Recursively look for WHAT starting in the current node.
TObject * Next()
Get next object from B-tree. Returns 0 when no more objects in tree.
Sequenceable collection abstract base class.
void SetTree(Int_t i, TBtNode *node)
#define ClassDef(name, id)
void Remove(Int_t idx)
Remove an element.
void MergeWithRight(TBtLeafNode *r, Int_t idx)
Merge.
void Reset()
Reset the B-tree iterator.
TObject ** GetObjectRef(const TObject *) const
std::map< std::string, std::string >::const_iterator iter
TObject * Found(const TObject *obj, TBtNode **which, Int_t *where)
Recursively look for WHAT starting in the current node.
Item stored in inner nodes of a TBtree.
TObject * GetKey(Int_t idx)
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
TBtLeafNode * LastLeafNode()
Return the last leaf node.
const Bool_t kIterForward
TBtNode(Int_t isleaf, TBtInnerNode *p, TBtree *t=0)
Create a B-tree node.
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...
TBtLeafNode * LastLeafNode()
return the last node.
TBtItem & GetItem(Int_t i) const
void MergeWithRight(TBtInnerNode *r, Int_t idx)
Merge the 2 part of the tree.
virtual TBtLeafNode * LastLeafNode()=0
void Split()
This function is called only when THIS is the only descendent of the root node, and THIS needs to be ...
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.
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 p...
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 p...
TBtNode * GetTree(Int_t i) const
void Append(TObject *obj, TBtNode *n)
Never called from anywhere where it might fill up THIS.
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...
void BalanceWithRight(TBtLeafNode *r, Int_t idx)
THIS has more than RIGHTSIB; move some items from THIS to RIGHTSIB.
TObject * operator*() const
Return current object or nullptr.
Collection abstract base class.
Int_t NofKeys() const
Number of key.
void DecrNofKeys(TBtNode *np)
THAT is a child of THIS that has just shrunk by 1.
void RootIsFull()
The root of the tree is full.
void Append(TObject *obj)
Never called from anywhere where it might fill up THIS does NOT handle nofKeys.
void IncrNofKeys(TBtNode *np)
THAT is a child of THIS that has just grown by 1.
TObject * operator[](Int_t i) const
void Init(Int_t i)
Initialize a B-tree.
void Remove(Int_t idx)
Remove an element.
virtual void Remove(Int_t index)=0
virtual TBtree * GetParentTree() const
Int_t IsAlmostFull() const
virtual Int_t FindRank(const TObject *obj) const =0
TObject * operator[](Int_t i) const
return an element.
TObject * Before(const TObject *obj) const
May not use this method since B-tree decides order.
~TBtLeafNode()
Destructor.
void AddAt(TObject *obj, Int_t)
~TBtInnerNode()
Constructor.
TObject * GetKey(Int_t i) const
void AddFirst(TObject *obj)
Int_t Rank(const TObject *obj) const
Returns the rank of the object in the tree.
void SplitWith(TBtLeafNode *r, Int_t idx)
Split.
TObject * Remove(TObject *obj)
Remove an object from the tree.
Int_t IncNofKeys(Int_t i, Int_t n=1)
void SetKey(Int_t i, TObject *obj)
void Delete(Option_t *option="")
Remove all objects from B-tree AND delete all heap based objects.
void BalanceWithLeft(TBtInnerNode *l, Int_t idx)
THIS has more than LEFTSIB.
void PushRight(Int_t cnt, TBtInnerNode *rightsib, Int_t parentIdx)
The operation is three steps:
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
void AddBefore(const TObject *, TObject *obj)
Mother of all ROOT objects.
void RemoveItem(Int_t idx)
Remove an item.
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.
Int_t IndexOf(const TObject *obj) const
Returns a number in the range 0 to MaxIndex().
TBtLeafNode * FirstLeafNode()
Return the first leaf node.
void ShiftLeft(Int_t cnt)
Shift to the left.
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 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 * FindObject(const char *name) const
Find object using its name (see object's GetName()).
const TCollection * GetCollection() const
Int_t GetNofKeys(Int_t i) const
virtual TBtLeafNode * FirstLeafNode()=0
void Split()
This function is called only when THIS is the only descendent of the root node, and THIS needs to be ...
virtual Int_t NofKeys() const =0
void Add(const TObject *obj, Int_t idx)
This is called only from TBtree::Add().
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 BalanceWith(TBtInnerNode *n, int idx)
PINDX is the index of the parent item whose key will change when keys are shifted from one InnerNode ...