comparison gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java @ 870:dfd02f8d3602

Removed trailing whitespace. gnv-artifacts/trunk@1010 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 28 Apr 2010 06:53:44 +0000
parents 05bf8534a35a
children f953c9a559d8
comparison
equal deleted inserted replaced
869:27112636e8bb 870:dfd02f8d3602
34 34
35 import org.apache.log4j.Logger; 35 import org.apache.log4j.Logger;
36 36
37 /** 37 /**
38 * This class is used to create a statistic in timeseries products. 38 * This class is used to create a statistic in timeseries products.
39 * 39 *
40 * @author blume 40 * @author blume
41 */ 41 */
42 public class TimeseriesStatistics 42 public class TimeseriesStatistics
43 extends AbstractStatistics 43 extends AbstractStatistics
44 { 44 {
45 45
46 /** 46 /**
47 * Default Logging instance 47 * Default Logging instance
113 if (!break1.equals(row.getString(b1Idx)) 113 if (!break1.equals(row.getString(b1Idx))
114 || !break2.equals(row.getString(b2Idx)) 114 || !break2.equals(row.getString(b2Idx))
115 || !break3.equals(row.getString(b3Idx)) 115 || !break3.equals(row.getString(b3Idx))
116 ) { 116 ) {
117 String statisticsName = generateStatisticsName( 117 String statisticsName = generateStatisticsName(
118 break1, break2, 118 break1, break2,
119 break3, parameters, 119 break3, parameters,
120 measurements, dates); 120 measurements, dates);
121 121
122 statisticSets.add( 122 statisticSets.add(
123 generateStatisticsValues( 123 generateStatisticsValues(
124 lStatistics, 124 lStatistics,
125 lRegression, 125 lRegression,
126 statisticsName)); 126 statisticsName));
127 127
128 lStatistics.clear(); 128 lStatistics.clear();
129 lRegression.clear(); 129 lRegression.clear();
130 130
131 clearStatistics(); 131 clearStatistics();
132 132
133 Double yValue = row.getDouble(yIdx); 133 Double yValue = row.getDouble(yIdx);
134 134
135 if (yValue != null) { 135 if (yValue != null) {
163 if (yValue != null) { 163 if (yValue != null) {
164 lStatistics.addValue(yValue); 164 lStatistics.addValue(yValue);
165 Double x = calculateXOrdinateValue(previousRow, row); 165 Double x = calculateXOrdinateValue(previousRow, row);
166 lRegression.addData(x, yValue); 166 lRegression.addData(x, yValue);
167 } 167 }
168 168
169 String statisticsName = generateStatisticsName( 169 String statisticsName = generateStatisticsName(
170 break1, break2, 170 break1, break2,
171 break3, parameters, 171 break3, parameters,
172 measurements, dates); 172 measurements, dates);
173 173
174 statisticSets.add(generateStatisticsValues( 174 statisticSets.add(generateStatisticsValues(
175 lStatistics, 175 lStatistics,
176 lRegression, 176 lRegression,
177 statisticsName)); 177 statisticsName));
178 lStatistics.clear(); 178 lStatistics.clear();
179 lRegression.clear(); 179 lRegression.clear();
180 } 180 }
181 } catch (Exception e) { 181 } catch (Exception e) {
187 187
188 /** 188 /**
189 * Nothing is done here. 189 * Nothing is done here.
190 */ 190 */
191 protected void clearStatistics(){} 191 protected void clearStatistics(){}
192 192
193 193
194 protected String generateStatisticsName(String break1, 194 protected String generateStatisticsName(String break1,
195 String break2, 195 String break2,
196 String break3, 196 String break3,
197 Collection<KeyValueDescibeData> parameters, 197 Collection<KeyValueDescibeData> parameters,
198 Collection<KeyValueDescibeData> measurements, 198 Collection<KeyValueDescibeData> measurements,
199 Collection<KeyValueDescibeData> dates){ 199 Collection<KeyValueDescibeData> dates){
200 log.debug("TimeseriesStatistics.generateStatisticsName"); 200 log.debug("TimeseriesStatistics.generateStatisticsName");
201 return this.findValueTitle(parameters,break1)+ " "+ 201 return this.findValueTitle(parameters,break1)+ " "+
202 this.findValueTitle(measurements,break2) + "m"; 202 this.findValueTitle(measurements,break2) + "m";
203 } 203 }
204 204
205 205
206 protected String findValueTitle(Collection<KeyValueDescibeData> values, 206 protected String findValueTitle(Collection<KeyValueDescibeData> values,
207 String id) { 207 String id) {
208 log.debug("TimeseriesStatistics.findValueTitle "+ id); 208 log.debug("TimeseriesStatistics.findValueTitle "+ id);
209 if (values != null) { 209 if (values != null) {
210 Iterator<KeyValueDescibeData> it = values.iterator(); 210 Iterator<KeyValueDescibeData> it = values.iterator();
216 } 216 }
217 } 217 }
218 return ""; 218 return "";
219 } 219 }
220 220
221 221
222 protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException { 222 protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException {
223 return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600); 223 return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600);
224 } 224 }
225 } 225 }
226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org