Пример #1
0
        protected RBNode <T> InsertNodeAfter(RBNode <T> node)
        {
            int        index;
            RBTree <T> root = GetRootAndIndex(node, out index);

            return(root.InsertNode(index + node.Size));
        }
Пример #2
0
        // Token: 0x06007693 RID: 30355 RVA: 0x0021E108 File Offset: 0x0021C308
        protected RBNode <T> InsertNodeAfter(RBNode <T> node)
        {
            int        num;
            RBTree <T> rootAndIndex = this.GetRootAndIndex(node, out num);

            return(rootAndIndex.InsertNode(num + node.Size));
        }
Пример #3
0
        // Token: 0x06007692 RID: 30354 RVA: 0x0021E07C File Offset: 0x0021C27C
        protected void RemoveAt(ref RBFinger <T> finger)
        {
            RBNode <T> node   = finger.Node;
            int        offset = finger.Offset;

            this.Copy(node, offset + 1, node, offset, node.Size - offset - 1);
            node.ChangeSize(-1);
            node.SetItemAt(node.Size, default(T));
            if (node.Size == 0)
            {
                finger.Node   = node.GetSuccessor();
                finger.Offset = 0;
                int        index;
                RBTree <T> rootAndIndex = node.GetRootAndIndex(node, out index);
                rootAndIndex.RemoveNode(index);
            }
            finger.Offset--;
        }
Пример #4
0
 // Token: 0x06007697 RID: 30359 RVA: 0x0021E3B4 File Offset: 0x0021C5B4
 protected RBNode <T> InsertNode(RBTree <T> root, RBNode <T> parent, RBNode <T> node, int index, out RBNode <T> newNode)
 {
     if (node == null)
     {
         newNode        = root.NewNode();
         newNode.Parent = parent;
         newNode.IsRed  = true;
         return(newNode);
     }
     if (index <= node.LeftSize)
     {
         node.LeftChild = this.InsertNode(root, node, node.LeftChild, index, out newNode);
     }
     else
     {
         node.RightChild = this.InsertNode(root, node, node.RightChild, index - node.LeftSize - node.Size, out newNode);
     }
     node = this.Fixup(node);
     return(node);
 }
Пример #5
0
        protected RBNode <T> InsertNode(RBTree <T> root, RBNode <T> parent, RBNode <T> node, int index, out RBNode <T> newNode)
        {
            if (node == null)
            {
                newNode        = root.NewNode();
                newNode.Parent = parent;
                newNode.IsRed  = true;
                return(newNode);
            }

            if (index <= node.LeftSize)
            {
                node.LeftChild = InsertNode(root, node, node.LeftChild, index, out newNode);
            }
            else
            {
                Debug.Assert(index >= node.LeftSize + node.Size, "InsertNode: index should fall between nodes");
                node.RightChild = InsertNode(root, node, node.RightChild, index - node.LeftSize - node.Size, out newNode);
            }

            node = Fixup(node);

            return(node);
        }