1 /**
2 * <copyright>
3 * Copyright 1997-2002 BBNT Solutions, LLC
4 * under sponsorship of the Defense Advanced Research Projects Agency (DARPA).
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the Cougaar Open Source License as published by
8 * DARPA on the Cougaar Open Source Website (www.cougaar.org).
9 *
10 * THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS
11 * PROVIDED 'AS IS' WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR
12 * IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT
14 * ANY WARRANTIES AS TO NON-INFRINGEMENT. IN NO EVENT SHALL COPYRIGHT
15 * HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL
16 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS,
17 * TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 * PERFORMANCE OF THE COUGAAR SOFTWARE.
19 * </copyright>
20 *
21 * Created on Aug 26, 2002
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 }