// Token: 0x060035C3 RID: 13763 RVA: 0x000F446C File Offset: 0x000F266C
        internal void InsertAtNode(SplayTreeNode positionNode, ElementEdge edge)
        {
            if (edge == ElementEdge.BeforeStart || edge == ElementEdge.AfterEnd)
            {
                this.InsertAtNode(positionNode, edge == ElementEdge.BeforeStart);
                return;
            }
            SplayTreeNode splayTreeNode;
            bool          insertBefore;

            if (edge == ElementEdge.AfterStart)
            {
                splayTreeNode = positionNode.GetFirstContainedNode();
                insertBefore  = true;
            }
            else
            {
                splayTreeNode = positionNode.GetLastContainedNode();
                insertBefore  = false;
            }
            if (splayTreeNode == null)
            {
                positionNode.ContainedNode = this;
                this.ParentNode            = positionNode;
                Invariant.Assert(this.LeftChildNode == null);
                Invariant.Assert(this.RightChildNode == null);
                Invariant.Assert(this.LeftSymbolCount == 0);
                return;
            }
            this.InsertAtNode(splayTreeNode, insertBefore);
        }
예제 #2
0
        // Inserts a node at a specified position.
        internal void InsertAtNode(SplayTreeNode positionNode, ElementEdge edge)
        {
            SplayTreeNode locationNode;
            bool          insertBefore;

            if (edge == ElementEdge.BeforeStart || edge == ElementEdge.AfterEnd)
            {
                // Insert to this node's tree.
                InsertAtNode(positionNode, edge == ElementEdge.BeforeStart /* insertBefore */);
            }
            else
            {
                // Insert to this node's contained tree.

                if (edge == ElementEdge.AfterStart)
                {
                    locationNode = positionNode.GetFirstContainedNode();
                    insertBefore = true;
                }
                else // ElementEdge == BeforeEnd
                {
                    locationNode = positionNode.GetLastContainedNode();
                    insertBefore = false;
                }

                if (locationNode == null)
                {
                    // Inserting the first contained node.
                    positionNode.ContainedNode = this;
                    this.ParentNode            = positionNode;
                    Invariant.Assert(this.LeftChildNode == null);
                    Invariant.Assert(this.RightChildNode == null);
                    Invariant.Assert(this.LeftSymbolCount == 0);
                }
                else
                {
                    InsertAtNode(locationNode, insertBefore);
                }
            }
        }
예제 #3
0
        // Inserts a node at a specified position.
        internal void InsertAtNode(SplayTreeNode positionNode, ElementEdge edge) 
        {
            SplayTreeNode locationNode; 
            bool insertBefore; 

            if (edge == ElementEdge.BeforeStart || edge == ElementEdge.AfterEnd) 
            {
                // Insert to this node's tree.
                InsertAtNode(positionNode, edge == ElementEdge.BeforeStart /* insertBefore */);
            } 
            else
            { 
                // Insert to this node's contained tree. 

                if (edge == ElementEdge.AfterStart) 
                {
                    locationNode = positionNode.GetFirstContainedNode();
                    insertBefore = true;
                } 
                else // ElementEdge == BeforeEnd
                { 
                    locationNode = positionNode.GetLastContainedNode(); 
                    insertBefore = false;
                } 

                if (locationNode == null)
                {
                    // Inserting the first contained node. 
                    positionNode.ContainedNode = this;
                    this.ParentNode = positionNode; 
                    Invariant.Assert(this.LeftChildNode == null); 
                    Invariant.Assert(this.RightChildNode == null);
                    Invariant.Assert(this.LeftSymbolCount == 0); 
                }
                else
                {
                    InsertAtNode(locationNode, insertBefore); 
                }
            } 
        }