001 /* 002 Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public License 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 017 018 package org.objectweb.jac.lib.stats; 019 020 public class Stat { 021 public Stat() { 022 } 023 024 public Stat(double sum, long count, double min, double max) { 025 this.sum = sum; 026 this.count = count; 027 this.min = min; 028 this.max = max; 029 } 030 031 double sum; 032 public double getSum() { 033 return sum; 034 } 035 public void setSum(double newSum) { 036 this.sum = newSum; 037 } 038 039 long count; 040 public long getCount() { 041 return count; 042 } 043 public void setCount(long count) { 044 this.count = count; 045 } 046 047 public double getAverage() { 048 return count!=0 ? sum / count : Double.NaN; 049 } 050 051 double min; 052 public double getMin() { 053 return min; 054 } 055 public void setMin(double newMin) { 056 this.min = newMin; 057 } 058 059 double max; 060 public double getMax() { 061 return max; 062 } 063 public void setMax(double newMax) { 064 this.max = newMax; 065 } 066 }