Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java @ 461:3ddc22aab764
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
ISSUE137
gnv-artifacts/trunk@515 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 08 Jan 2010 14:27:49 +0000 |
parents | 04cfb4e3da4f |
children | f7038820df2e |
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 java.util.Collection; |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.ArrayList; |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 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
|
7 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 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
|
9 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 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
|
11 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 /** |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 */ |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 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
|
16 implements Statistics |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 { |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 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
|
19 AbstractStatistics.class); |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 public AbstractStatistics() { |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 } |
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 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
|
25 DescriptiveStatistics lStatistics, |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 SimpleRegression lRegression, |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 String statisticName |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 ) { |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 StatisticSet statisticSet = new StatisticSet(statisticName); |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 statisticSet.addStatistic( |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 new Statistic( |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 "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
|
34 lStatistics.getMean())); |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 statisticSet.addStatistic( |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 new Statistic( |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 "gnviewer.statistics.descriptive.kurtosis", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 lStatistics.getKurtosis())); |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 |
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.max", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 lStatistics.getMax())); |
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( |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 "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
|
49 lStatistics.getMin())); |
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.n", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 lStatistics.getN())); |
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.percentile.90", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 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
|
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.percentile.75", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 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
|
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.50", |
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(50))); |
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.10", |
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(10))); |
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.deviation", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 lStatistics.getStandardDeviation())); |
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.variance", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 lStatistics.getVariance())); |
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.intercept", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 lRegression.getIntercept())); |
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.slope", |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 lRegression.getSlope())); |
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 return statisticSet; |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
04cfb4e3da4f
Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 // 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
|
100 |