Пример #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);
     }
 }
Пример #3
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);
     }
 }
Пример #4
0
 public override void getVisitor(IVisitor v)
 {
     v.Action(this);
 }