View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.vm.rule;
5   
6   import java.util.List;
7   
8   import net.sourceforge.pmd.RuleContext;
9   import net.sourceforge.pmd.lang.ast.Node;
10  import net.sourceforge.pmd.lang.rule.stat.StatisticalRule;
11  import net.sourceforge.pmd.lang.rule.stat.StatisticalRuleHelper;
12  import net.sourceforge.pmd.stat.DataPoint;
13  
14  public abstract class AbstractStatisticalVmRule extends AbstractVmRule implements StatisticalRule {
15  
16      private final StatisticalRuleHelper helper = new StatisticalRuleHelper(this);
17  
18      @Override
19      public void addDataPoint(final DataPoint point) {
20          helper.addDataPoint(point);
21      }
22  
23      @Override
24      public Object[] getViolationParameters(final DataPoint point) {
25          return null;
26      }
27  
28      @Override
29      public void apply(final List<? extends Node> nodes, final RuleContext ctx) {
30          super.apply(nodes, ctx);
31          helper.apply(ctx);
32      }
33  }