public BTreeNode(IHierarchyObj owner) { this.m_tuples = new BTreeNodeTupleList(3); BTreeNodeTuple tuple = new BTreeNodeTuple(this.CreateBTreeNode(null, owner), -1); this.m_tuples.Add(tuple, null); }
public void Add(BTreeNodeTuple tuple, ScalableList <BTreeNode> nodes) { if (this.m_list.Count == this.m_capacity) { throw new InvalidOperationException(); } this.m_list.Add(tuple); if (-1 != tuple.ChildIndex) { BTreeNode bTreeNode = default(BTreeNode); using (nodes.GetAndPin(tuple.ChildIndex, out bTreeNode)) { bTreeNode.IndexInParent = this.m_list.Count - 1; } } }
public bool SearchAndInsert(object keyValue, ScalableList <BTreeNode> nodes, IHierarchyObj owner, out BTreeNodeValue newSiblingValue, out int newSiblingIndex, out int globalNewSiblingIndex) { int num = -1; int i; for (i = 1; i < this.m_tuples.Count; i++) { BTreeNodeTuple bTreeNodeTuple = this.m_tuples[i]; num = bTreeNodeTuple.Value.CompareTo(keyValue, owner.OdpContext); if (num >= 0) { break; } } if (num == 0) { this.m_tuples[i].Value.AddRow(owner); } else { int childIndex = this.m_tuples[i - 1].ChildIndex; if (childIndex == -1) { return(this.InsertBTreeNode(nodes, this.CreateBTreeNode(keyValue, owner), i, -1, owner, out newSiblingValue, out newSiblingIndex, out globalNewSiblingIndex)); } BTreeNode bTreeNode = default(BTreeNode); using (nodes.GetAndPin(childIndex, out bTreeNode)) { BTreeNodeValue nodeValueToInsert = default(BTreeNodeValue); int nodeIndexToInsert = default(int); int globalNodeIndexToInsert = default(int); if (!bTreeNode.SearchAndInsert(keyValue, nodes, owner, out nodeValueToInsert, out nodeIndexToInsert, out globalNodeIndexToInsert)) { return(this.InsertBTreeNode(nodes, nodeValueToInsert, nodeIndexToInsert, globalNodeIndexToInsert, owner, out newSiblingValue, out newSiblingIndex, out globalNewSiblingIndex)); } } } newSiblingValue = null; newSiblingIndex = -1; globalNewSiblingIndex = -1; return(true); }
public void Insert(int index, BTreeNodeTuple tuple, ScalableList <BTreeNode> nodes) { if (this.m_list.Count == this.m_capacity) { throw new InvalidOperationException(); } this.m_list.Insert(index, tuple); for (int i = index; i < this.m_list.Count; i++) { int childIndex = this.m_list[i].ChildIndex; if (childIndex != -1) { BTreeNode bTreeNode = default(BTreeNode); using (nodes.GetAndPin(childIndex, out bTreeNode)) { bTreeNode.IndexInParent = i; } } } }