Esempio n. 1
0
        //Untested
        public void InsertNonFull(RTreeNode x, Rectangle k)
        {
            int i = x.NumberOfKeys - 1;

            if (x.IsLeaf)
            {
                while (i > 0 && comparer(k, x.GetKey(i), this.Boundary) < 0)
                {
                    i--;
                }

                x.InsertKey(i + 1, k);
            }
            else
            {
                while (i > 0 && comparer(k, x.GetPointer(i).Boundary, this.Boundary) < 0)
                {
                    i--;
                }

                if (x.GetPointer(i).NumberOfKeys == 2 * this.MinimumDegree - 1)
                {
                    SplitTheNode(x, i);

                    if (comparer(k, x.GetPointer(i).Boundary, this.Boundary) > 0)
                    {
                        i++;
                    }
                }

                InsertNonFull(x.GetPointer(i), k);

                x.FixBoundary();
            }
        }
Esempio n. 2
0
        //Untested
        public void InsertNonFull(RTreeNode x, Rectangle k)
        {
            if (x.IsLeaf)
            {
                x.AddKey(k);
            }
            else
            {
                int i = comparer(x.GetSubRectangles(), k);

                if (x.GetPointer(i).NumberOfKeys == 2 * this.MinimumDegree - 1)
                {
                    SplitTheNode(x, i);
                }

                InsertNonFull(x.GetPointer(i), k);

                x.FixBoundary();
            }
        }