~ubuntu-branches/ubuntu/quantal/commons-math/quantal

« back to all changes in this revision

Viewing changes to src/main/java/org/apache/commons/math/stat/descriptive/StatisticalSummaryValues.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2010-04-05 23:33:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100405233302-gpqlceked76nw28a
Tags: 2.1-1
* New upstream release.
* Bump Standards-Version to 3.8.4: no changes needed
* Bump debhelper to >= 7
* Switch to 3.0 (quilt) source format:
  - Remove B-D on quilt
  - Add d/source/format
  - Remove d/README.source

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
/**
23
23
 *  Value object representing the results of a univariate statistical summary.
24
24
 *
25
 
 * @version $Revision: 762087 $ $Date: 2009-04-05 10:20:18 -0400 (Sun, 05 Apr 2009) $
 
25
 * @version $Revision: 811833 $ $Date: 2009-09-06 12:27:50 -0400 (Sun, 06 Sep 2009) $
26
26
 */
27
 
public class StatisticalSummaryValues implements Serializable, 
 
27
public class StatisticalSummaryValues implements Serializable,
28
28
    StatisticalSummary {
29
 
   
 
29
 
30
30
    /** Serialization id */
31
31
    private static final long serialVersionUID = -5108854841843722536L;
32
32
 
33
33
    /** The sample mean */
34
34
    private final double mean;
35
 
    
 
35
 
36
36
    /** The sample variance */
37
37
    private final double variance;
38
 
    
 
38
 
39
39
    /** The number of observations in the sample */
40
40
    private final long n;
41
 
    
 
41
 
42
42
    /** The maximum value */
43
43
    private final double max;
44
 
    
 
44
 
45
45
    /** The minimum value */
46
46
    private final double min;
47
 
    
 
47
 
48
48
    /** The sum of the sample values */
49
49
    private final double sum;
50
 
    
 
50
 
51
51
    /**
52
52
      * Constructor
53
 
      * 
 
53
      *
54
54
      * @param mean  the sample mean
55
55
      * @param variance  the sample variance
56
 
      * @param n  the number of observations in the sample 
 
56
      * @param n  the number of observations in the sample
57
57
      * @param max  the maximum value
58
58
      * @param min  the minimum value
59
59
      * @param sum  the sum of the values
103
103
    public double getSum() {
104
104
        return sum;
105
105
    }
106
 
    
 
106
 
107
107
    /**
108
108
     * @return Returns the standard deviation
109
109
     */
117
117
    public double getVariance() {
118
118
        return variance;
119
119
    }
120
 
    
 
120
 
121
121
    /**
122
 
     * Returns true iff <code>object</code> is a 
 
122
     * Returns true iff <code>object</code> is a
123
123
     * <code>StatisticalSummaryValues</code> instance and all statistics have
124
124
     *  the same values as this.
125
 
     * 
 
125
     *
126
126
     * @param object the object to test equality against.
127
127
     * @return true if object equals this
128
128
     */
135
135
            return false;
136
136
        }
137
137
        StatisticalSummaryValues stat = (StatisticalSummaryValues) object;
138
 
        return (MathUtils.equals(stat.getMax(), this.getMax()) && 
139
 
                MathUtils.equals(stat.getMean(),this.getMean()) &&
140
 
                MathUtils.equals(stat.getMin(),this.getMin()) &&
141
 
                MathUtils.equals(stat.getN(), this.getN()) &&
142
 
                MathUtils.equals(stat.getSum(), this.getSum()) &&
143
 
                MathUtils.equals(stat.getVariance(),this.getVariance()));
 
138
        return MathUtils.equals(stat.getMax(),      getMax())  &&
 
139
               MathUtils.equals(stat.getMean(),     getMean()) &&
 
140
               MathUtils.equals(stat.getMin(),      getMin())  &&
 
141
               MathUtils.equals(stat.getN(),        getN())    &&
 
142
               MathUtils.equals(stat.getSum(),      getSum())  &&
 
143
               MathUtils.equals(stat.getVariance(), getVariance());
144
144
    }
145
 
    
 
145
 
146
146
    /**
147
147
     * Returns hash code based on values of statistics
148
 
     * 
 
148
     *
149
149
     * @return hash code
150
150
     */
151
151
    @Override