Exemplo n.º 1
0
 internal override TreeNode Print(DbExpressionVisitor<TreeNode> visitor)
 {
     var node = new TreeNode("DbSetClause");
     if (null != Property)
     {
         node.Children.Add(new TreeNode("Property", Property.Accept(visitor)));
     }
     if (null != Value)
     {
         node.Children.Add(new TreeNode("Value", Value.Accept(visitor)));
     }
     return node;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Called to recursively visit the child nodes of the current TreeNode.
        /// </summary>
        /// <param name="text">The StringBuilder into which the tree is being printed</param>
        /// <param name="node">The current node</param>
        internal virtual void PrintChildren(StringBuilder text, TreeNode node)
        {
            _scopes.Add(node);
            node.Position = 0;
            foreach (TreeNode childNode in node.Children)
            {
                text.AppendLine();
                node.Position++;
                PrintNode(text, childNode);
            }

            _scopes.RemoveAt(_scopes.Count - 1);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The recursive step of the printing process, called once for each TreeNode in the tree
        /// </summary>
        /// <param name="text">The StringBuilder into which the tree is being printed</param>
        /// <param name="node">The current node that should be printed to the StringBuilder</param>
        internal virtual void PrintNode(StringBuilder text, TreeNode node)
        {
            IndentLine(text);
            
            this.BeforeAppend(node, text);
            text.Append(node.Text.ToString());
            this.AfterAppend(node, text);

            PrintChildren(text, node);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Called once for every node immediately after the line prefix (if any) and appropriate
 /// indentation and connecting lines have been added to the output but before the node's
 /// text value has been added.
 /// </summary>
 /// <param name="node">The current node</param>
 /// <param name="text">The StringBuilder into which the tree is being printed</param>
 internal virtual void BeforeAppend(TreeNode node, StringBuilder text) { }
Exemplo n.º 5
0
 /// <summary>
 /// Called once for every node after indentation, connecting lines and the node's text value
 /// have been added to the output but before the line suffix (if any) has been added.
 /// </summary>
 /// <param name="node">The current node</param>
 /// <param name="text">The StringBuilder into which the tree is being printed</param>
 internal virtual void AfterAppend(TreeNode node, StringBuilder text) { }
Exemplo n.º 6
0
 // 'protected' API that may be overriden to customize printing
 
 /// <summary>
 /// Called once on the root of the tree before printing begins
 /// </summary>
 /// <param name="node">The TreeNode that is the root of the tree</param>
 internal virtual void PreProcess(TreeNode node) { }
Exemplo n.º 7
0
        /// <summary>
        /// Entry point method for the TreePrinter
        /// </summary>
        /// <param name="node">The TreeNode instance that is the root of the tree to be printed</param>
        /// <returns>A string representation of the specified tree</returns>
        internal virtual string Print(TreeNode node)
        {
             this.PreProcess(node);

            StringBuilder text = new StringBuilder();
            PrintNode(text, node);
            return text.ToString();
        }