Esempio n. 1
0
        public static BPlusTree <K> BuildGroundUp(int degree, SortedDictionary <K, RecordPointer> elements)
        {
            BPlusTree <K>   result = new BPlusTree <K>(degree);
            List <LeafNode> leafs  = BuildLevel <LeafNode, RecordPointer>(result, elements);

            for (int i = 0; i < leafs.Count - 1; i++)
            {
                leafs.ElementAt(i).Next = leafs.ElementAt(i + 1);
            }

            // build next levels
            Dictionary <K, LeafNode>       leafNodes        = leafs.ToDictionary(e => e.GetFirstLeafKey(), e => e);
            SortedDictionary <K, LeafNode> sortedLeafNodes  = new SortedDictionary <K, LeafNode>(leafNodes);
            SortedDictionary <K, Node>     sortedInputNodes = new SortedDictionary <K, Node>(sortedLeafNodes.ToDictionary(e => e.Key, e => (Node)e.Value));

            result.Root = BuildUpperLevel <LeafNode>(result, sortedLeafNodes).ElementAtOrDefault(0);

            return(result);
        }
Esempio n. 2
0
 public LeafNode(BPlusTree <K> _bptree)
 {
     BPTree              = _bptree;
     this.Keys           = new List <K>(this.MaxKeys());
     this.RecordPointers = new List <RecordPointer>(this.MaxPointers());
 }
Esempio n. 3
0
 public InternalNode(BPlusTree <K> _bptree)
 {
     BPTree        = _bptree;
     this.Keys     = new List <K>(this.MaxKeys());
     this.Pointers = new List <Node>(this.MaxPointers());
 }
Esempio n. 4
0
 public void SetTree(BPlusTree <K> tree)
 {
     Node.BPTree = tree;
 }