View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.rule;
5   
6   import java.util.List;
7   
8   import net.sourceforge.pmd.Rule;
9   import net.sourceforge.pmd.RuleContext;
10  import net.sourceforge.pmd.RuleSet;
11  import net.sourceforge.pmd.lang.ast.Node;
12  
13  /**
14   * The RuleChainVisitor understands how to visit an AST for a particular
15   * Language.
16   */
17  public interface RuleChainVisitor {
18      /**
19       * Add the given rule to the visitor.
20       * 
21       * @param ruleSet The RuleSet to which the rule belongs.
22       * @param rule The rule to add.
23       */
24      void add(RuleSet ruleSet, Rule rule);
25  
26      /**
27       * Visit all the given Nodes provided using the given RuleContext. Every
28       * Rule added will visit the AST as appropriate.
29       * 
30       * @param nodes The Nodes to visit.
31       * @param ctx The RuleContext.
32       */
33      void visitAll(List<Node> nodes, RuleContext ctx);
34  }