comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java @ 8062:8489565ff563

Sedimen load: Added bundle for fraction results.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 30 Jul 2014 16:50:26 +0200
parents 25feef564d09
children fe5ef780f8b1
comparison
equal deleted inserted replaced
8061:0000ed802cad 8062:8489565ff563
243 if (sld == null) { 243 if (sld == null) {
244 // TODO: i18n 244 // TODO: i18n
245 return error("minfo.sediment.load.no.data"); 245 return error("minfo.sediment.load.no.data");
246 } 246 }
247 247
248 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
249
248 boolean isKmUp = isKmUp(); 250 boolean isKmUp = isKmUp();
249 Set<Integer> missingFractions = new TreeSet<Integer>(); 251 Set<Integer> missingFractions = new TreeSet<Integer>();
250 252
251 Not notEpochs = new Not(IsEpoch.INSTANCE); 253 Not notEpochs = new Not(IsEpoch.INSTANCE);
252 254
266 // TODO: resolve i18n 268 // TODO: resolve i18n
267 addProblem("minfo.sediment.load.no.fractions", 269 addProblem("minfo.sediment.load.no.fractions",
268 gf.getDescription()); 270 gf.getDescription());
269 continue; 271 continue;
270 } 272 }
271 // TODO: Generate result data set for calculation.
272 // TODO: Optionally transform units. 273 // TODO: Optionally transform units.
274 SedimentLoadDataResult.Fraction sldrf =
275 new SedimentLoadDataResult.Fraction(gf.getDescription(), result);
276 sldr.addFraction(sldrf);
273 } 277 }
274 } 278 }
275 // TODO: Generate messages for missing fractions. 279 // TODO: Generate messages for missing fractions.
276 // TODO: Bundle sub results. 280 return new CalculationResult(sldr, this);
277 return null;
278 } 281 }
279 282
280 private CalculationResult calculateEpochs() { 283 private CalculationResult calculateEpochs() {
281 SedimentLoadData sld = 284 SedimentLoadData sld =
282 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river); 285 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
283 if (sld == null) { 286 if (sld == null) {
284 // TODO: i18n 287 // TODO: i18n
285 return error("minfo.sediment.load.no.data"); 288 return error("minfo.sediment.load.no.data");
286 } 289 }
287 290
291 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
292
288 boolean isKmUp = isKmUp(); 293 boolean isKmUp = isKmUp();
289 Set<Integer> missingFractions = new TreeSet<Integer>(); 294 Set<Integer> missingFractions = new TreeSet<Integer>();
290 295
291 // They are not epochs, they are single years! 296 // They are not epochs, they are single years!
292 Not notEpochs = new Not(IsEpoch.INSTANCE); 297 Not notEpochs = new Not(IsEpoch.INSTANCE);
307 // TODO: resolve i18n 312 // TODO: resolve i18n
308 addProblem("minfo.sediment.load.no.fractions", 313 addProblem("minfo.sediment.load.no.fractions",
309 gf.getDescription()); 314 gf.getDescription());
310 continue; 315 continue;
311 } 316 }
312 // TODO: Generate result data set for calculation.
313 // TODO: Optionally transform units. 317 // TODO: Optionally transform units.
318 SedimentLoadDataResult.Fraction sldrf =
319 new SedimentLoadDataResult.Fraction(gf.getDescription(), result);
320 sldr.addFraction(sldrf);
314 } 321 }
315 } 322 }
316 // TODO: Generate messages for missing fractions. 323 // TODO: Generate messages for missing fractions.
317 // TODO: Bundle sub results. 324 return new CalculationResult(sldr, this);
318 return null;
319 } 325 }
320 326
321 private CalculationResult calculateOffEpochs() { 327 private CalculationResult calculateOffEpochs() {
322 SedimentLoadData sld = 328 SedimentLoadData sld =
323 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river); 329 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
324 if (sld == null) { 330 if (sld == null) {
325 // TODO: i18n 331 // TODO: i18n
326 return error("minfo.sediment.load.no.data"); 332 return error("minfo.sediment.load.no.data");
327 } 333 }
328 334
335 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
336
329 boolean isKmUp = isKmUp(); 337 boolean isKmUp = isKmUp();
330 Set<Integer> missingFractions = new TreeSet<Integer>(); 338 Set<Integer> missingFractions = new TreeSet<Integer>();
331 339
332 for (int [] epoch: epochs) { 340 for (int [] epoch: epochs) {
333 Value.Filter filter = new And() 341 Value.Filter filter = new And()
345 // TODO: resolve i18n 353 // TODO: resolve i18n
346 addProblem("minfo.sediment.load.no.fractions", 354 addProblem("minfo.sediment.load.no.fractions",
347 gf.getDescription()); 355 gf.getDescription());
348 continue; 356 continue;
349 } 357 }
350 // TODO: Generate result data set for calculation.
351 // TODO: Optionally transform units. 358 // TODO: Optionally transform units.
359 SedimentLoadDataResult.Fraction sldrf =
360 new SedimentLoadDataResult.Fraction(gf.getDescription(), result);
361 sldr.addFraction(sldrf);
352 } 362 }
353 } 363 }
354 // TODO: Generate messages for missing fractions. 364 // TODO: Generate messages for missing fractions.
355 // TODO: Bundle sub results. 365 return new CalculationResult(sldr, this);
356 // TODO: Implement me!
357 return null;
358 } 366 }
359 367
360 /** Figure out flow direction of river. */ 368 /** Figure out flow direction of river. */
361 private boolean isKmUp() { 369 private boolean isKmUp() {
362 River r = RiverFactory.getRiver(river); 370 River r = RiverFactory.getRiver(river);

http://dive4elements.wald.intevation.org