View Javadoc

1   package net.sourceforge.pmd.lang.java.rule;
2   
3   import java.util.List;
4   
5   import net.sourceforge.pmd.RuleContext;
6   import net.sourceforge.pmd.lang.ast.Node;
7   import net.sourceforge.pmd.lang.rule.stat.StatisticalRule;
8   import net.sourceforge.pmd.lang.rule.stat.StatisticalRuleHelper;
9   import net.sourceforge.pmd.stat.DataPoint;
10  
11  public abstract class AbstractStatisticalJavaRule extends AbstractJavaRule implements StatisticalRule {
12  
13      private final StatisticalRuleHelper helper = new StatisticalRuleHelper(this);
14  
15      public void addDataPoint(DataPoint point) {
16  	helper.addDataPoint(point);
17      }
18  
19      public Object[] getViolationParameters(DataPoint point) {
20  	return null;
21      }
22  
23      @Override
24      public void apply(List<? extends Node> nodes, RuleContext ctx) {
25  	super.apply(nodes, ctx);
26  	helper.apply(ctx);
27      }
28  }