示例#1
0
 private void Visit(Node node, IVisitor v)
 {
     if (node == null)
     {
         return;
     }
     Visit(node.left, v);
     v.Action(node);
     Visit(node.right, v);
 }
示例#2
0
 /// <summary>
 /// Visit all nodes in the binary tree.
 /// </summary>
 /// <param name="visitor">Visitor</param>
 /// <param name="curNode">Current node</param>
 protected virtual void Visit(IVisitor visitor, MathParserTreeNode curNode)
 {
     if (curNode != null)
     {
         if (curNode.Left != null)
             Visit(visitor, curNode.Left);
         if (curNode.Right != null)
             Visit(visitor, curNode.Right);
         visitor.Action(curNode);
     }
 }
 /// <summary>
 /// Visit all nodes in the binary tree.
 /// </summary>
 /// <param name="visitor">Visitor</param>
 /// <param name="curNode">Current node</param>
 protected virtual void Visit(IVisitor visitor, MathParserTreeNode curNode)
 {
     if (curNode != null)
     {
         if (curNode.Left != null)
         {
             Visit(visitor, curNode.Left);
         }
         if (curNode.Right != null)
         {
             Visit(visitor, curNode.Right);
         }
         visitor.Action(curNode);
     }
 }
示例#4
0
 public override void getVisitor(IVisitor v)
 {
     v.Action(this);
 }