KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > lib > stats > Stat


1 /*
2   Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.lib.stats;
19
20 public class Stat {
21    public Stat() {
22    }
23
24    public Stat(double sum, long count, double min, double max) {
25       this.sum = sum;
26       this.count = count;
27       this.min = min;
28       this.max = max;
29    }
30
31    double sum;
32    public double getSum() {
33       return sum;
34    }
35    public void setSum(double newSum) {
36       this.sum = newSum;
37    }
38
39    long count;
40    public long getCount() {
41       return count;
42    }
43    public void setCount(long count) {
44       this.count = count;
45    }
46
47    public double getAverage() {
48       return count!=0 ? sum / count : Double.NaN;
49    }
50
51    double min;
52    public double getMin() {
53       return min;
54    }
55    public void setMin(double newMin) {
56       this.min = newMin;
57    }
58
59    double max;
60    public double getMax() {
61       return max;
62    }
63    public void setMax(double newMax) {
64       this.max = newMax;
65    }
66 }
67
Popular Tags