public abstract class AbstractRuleChainVisitor extends java.lang.Object implements RuleChainVisitor
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
AbstractRuleChainVisitor() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected java.util.Map<RuleSet,java.util.List<Rule>> ruleSetRules
protected java.util.Map<java.lang.String,java.util.List<SimpleNode>> nodeNameToNodes
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(java.util.List<CompilationUnit> astCompilationUnits, RuleContext ctx)
RuleChainVisitor
visitAll
in interface RuleChainVisitor
astCompilationUnits
- The ASTCompilationUnits to visit.ctx
- The RuleContext.RuleChainVisitor.visitAll(List, RuleContext)
protected abstract void visit(Rule rule, SimpleNode node, RuleContext ctx)
protected abstract void indexNodes(java.util.List<CompilationUnit> astCompilationUnits, RuleContext ctx)
protected void indexNode(SimpleNode node)
protected void initialize()
protected void clear()