diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java new file mode 100644 index 0000000000..eeaf6554f4 --- /dev/null +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/AbstractStatisticalApexRule.java @@ -0,0 +1,32 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package net.sourceforge.pmd.lang.apex.rule; + +import java.util.List; + +import net.sourceforge.pmd.RuleContext; +import net.sourceforge.pmd.lang.ast.Node; +import net.sourceforge.pmd.lang.rule.stat.StatisticalRule; +import net.sourceforge.pmd.lang.rule.stat.StatisticalRuleHelper; +import net.sourceforge.pmd.stat.DataPoint; + +public abstract class AbstractStatisticalApexRule extends AbstractApexRule implements StatisticalRule { + + private final StatisticalRuleHelper helper = new StatisticalRuleHelper( + this); + + public void addDataPoint(DataPoint point) { + helper.addDataPoint(point); + } + + public Object[] getViolationParameters(DataPoint point) { + return null; + } + + @Override + public void apply(List nodes, RuleContext ctx) { + super.apply(nodes, ctx); + helper.apply(ctx); + } +}