|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.lang.rule.AbstractRuleChainVisitor
public abstract class AbstractRuleChainVisitor
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 Map<String,List<Node>> |
nodeNameToNodes
This is a mapping from node names to nodes instances for the current AST. |
protected Map<RuleSet,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(Node node)
Index a single node for visitation by rules. |
protected abstract void |
indexNodes(List<Node> nodes,
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,
Node node,
RuleContext ctx)
Visit the given rule to the given node. |
void |
visitAll(List<Node> nodes,
RuleContext ctx)
Visit all the given Nodes 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 |
---|
protected Map<RuleSet,List<Rule>> ruleSetRules
protected Map<String,List<Node>> nodeNameToNodes
Constructor Detail |
---|
public AbstractRuleChainVisitor()
Method Detail |
---|
public void add(RuleSet ruleSet, Rule rule)
RuleChainVisitor
add
in interface RuleChainVisitor
ruleSet
- The RuleSet to which the rule belongs.rule
- The rule to add.RuleChainVisitor.add(RuleSet, Rule)
public void visitAll(List<Node> nodes, RuleContext ctx)
RuleChainVisitor
visitAll
in interface RuleChainVisitor
nodes
- The Nodes to visit.ctx
- The RuleContext.RuleChainVisitor.visitAll(List, RuleContext)
protected abstract void visit(Rule rule, Node node, RuleContext ctx)
protected abstract void indexNodes(List<Node> nodes, RuleContext ctx)
protected void indexNode(Node node)
protected void initialize()
protected void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |