コード例 #1
0
        // 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
        // Dumps a node and all following nodes "flat" -- in notation similar to xaml.
        internal static void DumpNodeFlatRecursive(SplayTreeNode node)
        {
            for (; node != null; node = node.GetNextNode())
            {
                Debug.Write("<" + GetFlatPrefix(node) + node.DebugId);

                if (node.ContainedNode != null)
                {
                    Debug.Write(">");
                    DumpNodeFlatRecursive(node.GetFirstContainedNode());
                    Debug.Write("</" + GetFlatPrefix(node) + node.DebugId + ">");
                }
                else
                {
                    Debug.Write("/>");
                }
            }
        }
コード例 #3
0
ファイル: SplayTreeNode.cs プロジェクト: dox0/DotNet471RS3
        // 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);
                }
            }
        }
コード例 #4
0
ファイル: SplayTreeNode.cs プロジェクト: sjyanxin/WPFSource
        // 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); 
                }
            } 
        } 
コード例 #5
0
ファイル: TextTreeDumper.cs プロジェクト: mind0n/hive
        // Dumps a node and all following nodes "flat" -- in notation similar to xaml.
        internal static void DumpNodeFlatRecursive(SplayTreeNode node)
        {
            for (; node != null; node = node.GetNextNode())
            {
                Debug.Write("<" + GetFlatPrefix(node) + node.DebugId);

                if (node.ContainedNode != null)
                {
                    Debug.Write(">");
                    DumpNodeFlatRecursive(node.GetFirstContainedNode());
                    Debug.Write("</" + GetFlatPrefix(node) + node.DebugId + ">");
                }
                else
                {
                    Debug.Write("/>");
                }
            }

        }
コード例 #6
0
ファイル: TextContainer.cs プロジェクト: sjyanxin/WPFSource
        //----------------------------------------------------- 
        //
        //  Private Methods 
        //
        //------------------------------------------------------

        #region Private Methods 

        // Scans all the immediate contained nodes of a TextElementNode, and 
        // calls AddLogicalChild methods if supported to alert the children 
        // about a new parent.
        private void ReparentLogicalChildren(SplayTreeNode containerNode, DependencyObject newParentLogicalNode, DependencyObject oldParentLogicalNode) 
        {
            ReparentLogicalChildren(containerNode.GetFirstContainedNode(), null, newParentLogicalNode, oldParentLogicalNode);
        }
コード例 #7
0
ファイル: TextPointer.cs プロジェクト: mind0n/hive
        // Debug only.  Walks a node and all its children to get a brute force
        // symbol count.
        private static int GetNodeSymbolCountSlow(SplayTreeNode node)
        {
            SplayTreeNode child;
            int count;

            if (node is TextTreeRootNode || node is TextTreeTextElementNode)
            {
                count = 2;
                for (child = node.GetFirstContainedNode(); child != null; child = child.GetNextNode())
                {
                    count += GetNodeSymbolCountSlow(child);
                }
            }
            else
            {
                Invariant.Assert(node.ContainedNode == null, "Expected leaf node!");
                count = node.SymbolCount;
            }

            return count;
        }