sascha@454: package de.intevation.gnv.statistics; sascha@454: sascha@454: import java.util.Collection; sascha@454: import java.util.ArrayList; sascha@454: sascha@454: import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; sascha@454: sascha@454: import org.apache.commons.math.stat.regression.SimpleRegression; sascha@454: sascha@454: import org.apache.log4j.Logger; sascha@454: sascha@454: /** sascha@454: * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) sascha@454: */ sascha@454: public abstract class AbstractStatistics sascha@454: implements Statistics sascha@454: { sascha@454: private static Logger log = Logger.getLogger( sascha@454: AbstractStatistics.class); sascha@454: sascha@454: public AbstractStatistics() { sascha@454: } sascha@454: sascha@454: protected StatisticSet generateStatisticsValues( sascha@454: DescriptiveStatistics lStatistics, sascha@454: SimpleRegression lRegression, sascha@454: String statisticName sascha@454: ) { sascha@454: StatisticSet statisticSet = new StatisticSet(statisticName); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.arithmeticMean", sascha@454: lStatistics.getMean())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.kurtosis", sascha@454: lStatistics.getKurtosis())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.max", sascha@454: lStatistics.getMax())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.min", sascha@454: lStatistics.getMin())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.n", sascha@454: lStatistics.getN())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.percentile.90", sascha@454: lStatistics.getPercentile(90))); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.percentile.75", sascha@454: lStatistics.getPercentile(75))); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.percentile.50", sascha@454: lStatistics.getPercentile(50))); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.percentile.10", sascha@454: lStatistics.getPercentile(10))); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.deviation", sascha@454: lStatistics.getStandardDeviation())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.variance", sascha@454: lStatistics.getVariance())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.intercept", sascha@454: lRegression.getIntercept())); sascha@454: sascha@454: statisticSet.addStatistic( sascha@454: new Statistic( sascha@454: "gnviewer.statistics.descriptive.slope", sascha@454: lRegression.getSlope())); sascha@454: sascha@454: return statisticSet; sascha@454: } sascha@454: } sascha@454: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : sascha@454: