//
// Generated by JTB 1.3.2 DIT@UoA patched
//

package visitor;
import syntaxtree.*;
import java.util.*;

/**
 * Provides default methods which visit each node in the tree in depth-first
 * order.  Your visitors may extend this class.
 */
public class DepthFirstVisitor implements Visitor {
   //
   // Auto class visitors--probably don't need to be overridden.
   //
   public void visit(NodeList n) {
      for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
         e.nextElement().accept(this);
   }

   public void visit(NodeListOptional n) {
      if ( n.present() )
         for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
            e.nextElement().accept(this);
   }

   public void visit(NodeOptional n) {
      if ( n.present() )
         n.node.accept(this);
   }

   public void visit(NodeSequence n) {
      for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
         e.nextElement().accept(this);
   }

   public void visit(NodeToken n) {}

   //
   // User-generated visitor methods below
   //

   /**
    * f0 -> AdditiveExpression()
    * f1 -> <EOF>
    */
   public void visit(Goal n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> MultiplicativeExpression()
    * f1 -> AdditiveExpressionTail()
    */
   public void visit(AdditiveExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> ( AdditiveExpressionTerm() )*
    */
   public void visit(AdditiveExpressionTail n) {
      n.f0.accept(this);
   }

   /**
    * f0 -> PlusExpression()
    *       | MinusExpression()
    */
   public void visit(AdditiveExpressionTerm n) {
      n.f0.accept(this);
   }

   /**
    * f0 -> "+"
    * f1 -> MultiplicativeExpression()
    */
   public void visit(PlusExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> "-"
    * f1 -> MultiplicativeExpression()
    */
   public void visit(MinusExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> PrimaryExpression()
    * f1 -> MultiplicativeExpressionTail()
    */
   public void visit(MultiplicativeExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> ( MultiplicativeExpressionTerm() )*
    */
   public void visit(MultiplicativeExpressionTail n) {
      n.f0.accept(this);
   }

   /**
    * f0 -> MultExpression()
    *       | DivExpression()
    */
   public void visit(MultiplicativeExpressionTerm n) {
      n.f0.accept(this);
   }

   /**
    * f0 -> "*"
    * f1 -> PrimaryExpression()
    */
   public void visit(MultExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> "/"
    * f1 -> PrimaryExpression()
    */
   public void visit(DivExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
   }

   /**
    * f0 -> Constant()
    *       | BracketExpression()
    */
   public void visit(PrimaryExpression n) {
      n.f0.accept(this);
   }

   /**
    * f0 -> "("
    * f1 -> AdditiveExpression()
    * f2 -> ")"
    */
   public void visit(BracketExpression n) {
      n.f0.accept(this);
      n.f1.accept(this);
      n.f2.accept(this);
   }

   /**
    * f0 -> <NUMBER>
    */
   public void visit(Constant n) {
      n.f0.accept(this);
   }

}
