Пример #1
0
            public override void PrependTo(Node node)
            {
                RoutingNode target = node as RoutingNode;

                for (int i = 0; i < _count; i++)
                {
                    target.InsertNode(_keys[i], _nodes[i], i);
                }
            }
Пример #2
0
            public override void AppendTo(Node node, int count)
            {
                RoutingNode target = node as RoutingNode;

                for (int i = 0; i < count; i++)
                {
                    target.InsertNode(_keys[i], _nodes[i], target._count);
                }
                Array.Copy(_keys, count, _keys, 0, _count - count);
                Array.Copy(_nodes, count, _nodes, 0, _count - count);
                _count -= count;
            }
Пример #3
0
        public void Insert(IComparable key, object data)
        {
            for (;;)
            {
                if (!_root.Insert(key, data, this))
                {
                    RoutingNode newRoot  = AcquireRoutingNode();
                    Node        newChild = SplitNode(_root);
                    newRoot.InsertNode(_root._keys[0], _root, 0);
                    newRoot.InsertNode(newChild._keys[0], newChild, 1);
                    _root = newRoot;

                                        #if (DEBUG)
                    _height++;
                                        #endif

                    continue;
                }
                break;
            }
            _count++;
        }