View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.stat;
5   
6   /**
7    * This class holds all sorts of statistical information.
8    *
9    * @author David Dixon-Peugh
10   */
11  public class Metric {
12      private String metricName = null;
13      private int count = 0;
14      private double total = 0.0;
15      private double low = -1.0;
16      private double high = -1.0;
17      private double mean = -1.0;
18      private double stddev = -1.0;
19  
20      /**
21       * Creates a new metric with the given information.
22       * @param name the metric's name
23       * @param count count of occurrences
24       * @param total the total value of the metric
25       * @param low the lowest value of the metric
26       * @param high the highest value of the metric
27       * @param mean the mean value
28       * @param stddev the standard deviation
29       */
30      public Metric(String name, int count, double total, double low, double high, double mean, double stddev) {
31          this.metricName = name;
32          this.low = low;
33          this.high = high;
34          this.mean = mean;
35          this.stddev = stddev;
36          this.count = count;
37          this.total = total;
38      }
39  
40      public String getMetricName() {
41          return metricName;
42      }
43  
44      public double getLowValue() {
45          return low;
46      }
47  
48      public double getHighValue() {
49          return high;
50      }
51  
52      public double getAverage() {
53          return mean;
54      }
55  
56      public double getStandardDeviation() {
57          return stddev;
58      }
59  
60      public int getCount() {
61          return count;
62      }
63  
64      public double getTotal() {
65          return total;
66      }
67  }