annotate gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java @ 1106:8ce8979f51df

Added the transition chain for the external mapviewer call (issue318). gnv-artifacts/trunk@1237 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 29 Jun 2010 07:09:13 +0000
parents 2423cefe7d39
children f953c9a559d8
rev   line source
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.statistics;
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import org.apache.commons.math.stat.regression.SimpleRegression;
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 /**
814
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
10 * An abstract implementation of <code>Statistics</code> with a default
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
11 * implementation of the {@link #generateStatisticsValues(org.apache.commons.math.stat.descriptive.DescriptiveStatistics, org.apache.commons.math.stat.regression.SimpleRegression, java.lang.String)}
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
12 * method.
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 814
diff changeset
13 *
780
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
14 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 */
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 public abstract class AbstractStatistics
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 implements Statistics
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 {
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 private static Logger log = Logger.getLogger(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 AbstractStatistics.class);
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 public AbstractStatistics() {
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 }
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
814
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
25 /**
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
26 * This method takes a statistics object and puts relevant values into a
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
27 * <code>StatisticSet</code>.
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
28 *
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
29 * @param lStatistics A statistics object.
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
30 * @param lRegression A simple regression.
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
31 * @param statisticName Name for the resulting statistic.
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
32 * @return a set of statistics.
9d427dd2a96a Added Javadoc in statistic package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
33 */
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 protected StatisticSet generateStatisticsValues(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 DescriptiveStatistics lStatistics,
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 465
diff changeset
36 SimpleRegression lRegression,
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 String statisticName
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 ) {
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 StatisticSet statisticSet = new StatisticSet(statisticName);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 465
diff changeset
40
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 "gnviewer.statistics.descriptive.arithmeticMean",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 lStatistics.getMean()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 new Statistic(
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 465
diff changeset
48 "gnviewer.statistics.descriptive.kurtosis",
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 lStatistics.getKurtosis()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 "gnviewer.statistics.descriptive.max",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 lStatistics.getMax()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 "gnviewer.statistics.descriptive.min",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 lStatistics.getMin()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 "gnviewer.statistics.descriptive.n",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 lStatistics.getN()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 "gnviewer.statistics.descriptive.percentile.90",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 lStatistics.getPercentile(90)));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 "gnviewer.statistics.descriptive.percentile.75",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 lStatistics.getPercentile(75)));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 "gnviewer.statistics.descriptive.percentile.50",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 lStatistics.getPercentile(50)));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 "gnviewer.statistics.descriptive.percentile.10",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 lStatistics.getPercentile(10)));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 "gnviewer.statistics.descriptive.deviation",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 lStatistics.getStandardDeviation()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 "gnviewer.statistics.descriptive.variance",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 lStatistics.getVariance()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 new Statistic(
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 465
diff changeset
98 "gnviewer.statistics.descriptive.intercept",
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 lRegression.getIntercept()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 statisticSet.addStatistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 new Statistic(
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 "gnviewer.statistics.descriptive.slope",
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 lRegression.getSlope()));
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 return statisticSet;
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 }
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 }
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110

http://dive4elements.wald.intevation.org