Exemplo n.º 1
0
        private void Insert(int CrawlerPointer, TKey Key, T Value)
        {
            BNode <T, TKey> Crawler = BNode <T, TKey> .DiskRead(File, Degree, CrawlerPointer, TFactory, TKeyFactory);

            if (Crawler.Leaf)
            {
                MoveUp(Crawler, Key, Value, int.MinValue);
                UpdateHeader();
            }
            else
            {
                Insert(Crawler.ChildrenPointers[Crawler.FirstPointerOfNodeContaining(Key)], Key, Value);
            }
        }
Exemplo n.º 2
0
        private BNode <T, TKey> BTreeSearch(int CrawlerPointer, TKey Key, out int Pointer)
        {
            BNode <T, TKey> Crawler = BNode <T, TKey> .DiskRead(File, Degree, CrawlerPointer, TFactory, TKeyFactory);

            Pointer = Crawler.PrecisePointer(Key);
            if (Pointer != -1)
            {
                return(Crawler);
            }
            else
            {
                if (Crawler.Leaf)
                {
                    return(null);
                }
                else
                {
                    int FirstPointerOfNodeContaining = Crawler.FirstPointerOfNodeContaining(Key);
                    return(BTreeSearch(Crawler.ChildrenPointers[FirstPointerOfNodeContaining], Key, out Pointer));
                }
            }
        }