Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.pmd
Class AbstractRuleChainVisitor

    java.lang.Object
      net.sourceforge.pmd.AbstractRuleChainVisitor

All Implemented Interfaces:
  RuleChainVisitor

Direct Known Subclasses:
  JavaRuleChainVisitor, JspRuleChainVisitor

    public abstract class AbstractRuleChainVisitor

extends java.lang.Object
implements RuleChainVisitor

This is a base class for RuleChainVisitor implementations which extracts interesting nodes from an AST, and lets each Rule visit the nodes it has expressed interest in.

Field Summary
`protected java.util.Map<java.lang.String,java.util.List<SimpleNode>>` | `nodeNameToNodes` This is a mapping from node names to nodes instances for the current AST.
`protected java.util.Map<RuleSet,java.util.List<Rule>>` | `ruleSetRules` These are all the rules participating in the RuleChain, grouped by RuleSet.

Constructor Summary
`AbstractRuleChainVisitor()`

Method Summary
`void` | `add(RuleSet ruleSet, Rule rule)` Add the given rule to the visitor.
`protected void` | `clear()` Clears the internal data structure used to manage the nodes visited between visiting different ASTs.
`protected void` | `indexNode(SimpleNode node)` Index a single node for visitation by rules.
`protected abstract void` | `indexNodes(java.util.List<CompilationUnit> astCompilationUnits, RuleContext ctx)` Index all nodes for visitation by rules.
`protected void` | `initialize()` Initialize the RuleChainVisitor to be ready to perform visitations.
`protected abstract void` | `visit(Rule rule, SimpleNode node, RuleContext ctx)` Visit the given rule to the given node.
`void` | `visitAll(java.util.List<CompilationUnit> astCompilationUnits, RuleContext ctx)` Visit all the given ASTCompilationUnits provided using the given RuleContext.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ruleSetRules

    protected java.util.Map<RuleSet,java.util.List<Rule>> ruleSetRules

  These are all the rules participating in the RuleChain, grouped by RuleSet.

### nodeNameToNodes

    protected java.util.Map<java.lang.String,java.util.List<SimpleNode>> nodeNameToNodes

  This is a mapping from node names to nodes instances for the current AST.

Constructor Detail

### AbstractRuleChainVisitor

    public AbstractRuleChainVisitor()

Method Detail

### add

    public void add(RuleSet ruleSet,
                    Rule rule)

  Description copied from interface: `RuleChainVisitor`
  Add the given rule to the visitor.

  Specified by:
    `add` in interface `RuleChainVisitor`
  Parameters:
    `ruleSet` - The RuleSet to which the rule belongs.
    `rule` - The rule to add.
  See Also:
    `RuleChainVisitor.add(RuleSet, Rule)`

### visitAll

    public void visitAll(java.util.List<CompilationUnit> astCompilationUnits,
                         RuleContext ctx)

  Description copied from interface: `RuleChainVisitor`
  Visit all the given ASTCompilationUnits provided using the given RuleContext. Every Rule added will visit the AST as appropriate.

  Specified by:
    `visitAll` in interface `RuleChainVisitor`
  Parameters:
    `astCompilationUnits` - The ASTCompilationUnits to visit.
    `ctx` - The RuleContext.
  See Also:
    `RuleChainVisitor.visitAll(List, RuleContext)`

### visit

    protected abstract void visit(Rule rule,
                                  SimpleNode node,
                                  RuleContext ctx)

  Visit the given rule to the given node.

### indexNodes

    protected abstract void indexNodes(java.util.List<CompilationUnit> astCompilationUnits,
                                       RuleContext ctx)

  Index all nodes for visitation by rules.

### indexNode

    protected void indexNode(SimpleNode node)

  Index a single node for visitation by rules.

### initialize

    protected void initialize()

  Initialize the RuleChainVisitor to be ready to perform visitations. This method should not be called until it is known that all Rules participating in the RuleChain are ready to be initialized themselves. Some rules may require full initialization to determine if they will participate in the RuleChain, so this has been delayed as long as possible to ensure that manipulation of the Rules is no longer occurring.

### clear

    protected void clear()

  Clears the internal data structure used to manage the nodes visited between visiting different ASTs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2009 InfoEther. All Rights Reserved.