1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.sourceforge.pmd.stat;
24
25 import java.util.List;
26
27 import net.sourceforge.pmd.FooRule;
28 import net.sourceforge.pmd.RuleContext;
29 import net.sourceforge.pmd.lang.ast.Node;
30 import net.sourceforge.pmd.lang.rule.stat.StatisticalRule;
31 import net.sourceforge.pmd.lang.rule.stat.StatisticalRuleHelper;
32
33 public class MockStatisticalRule extends FooRule implements StatisticalRule {
34
35 private StatisticalRuleHelper helper;
36
37 public MockStatisticalRule() {
38 helper = new StatisticalRuleHelper(this);
39 }
40
41 @Override
42 public String getName() {
43 return this.getClass().getName();
44 }
45
46 @Override
47 public void apply(List<? extends Node> nodes, RuleContext ctx) {
48 super.apply(nodes, ctx);
49 helper.apply(ctx);
50 }
51
52 @Override
53 public void addDataPoint(DataPoint point) {
54 helper.addDataPoint(point);
55 }
56
57 @Override
58 public Object[] getViolationParameters(DataPoint point) {
59 return null;
60 }
61 }