Mercurial > dive4elements > river
changeset 8132:58e3fed51e9e
GetFractionByName now returns a list as it can differ in Epochs
One result can be calculated with multiple epochs. there is
a todo in there to correctly split up the epochs in the facets.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 25 Aug 2014 20:00:45 +0200 |
parents | fae48b3c09d1 |
children | 45b1d71110c3 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java Mon Aug 25 19:59:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java Mon Aug 25 20:00:45 2014 +0200 @@ -110,12 +110,18 @@ SedimentLoadDataResult sdResult = (SedimentLoadDataResult) payload; - Fraction frac = sdResult.getFractionByName(fraction); - if (frac == null) { + List<Fraction> fractions = sdResult.getFractionsByName(fraction); + if (fractions == null) { logger.warn("No result for: " + fraction); + return null; } - return frac.getData(); + /* TODO handle multiple periods per fraction */ + if (fractions.size() > 1) { + logger.warn("Multiple periods not implemented."); + } + + return fractions.get(0).getData(); /* Are gaps neccessary now? for (int x = 0; x < values[0].length-1; x++) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java Mon Aug 25 19:59:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java Mon Aug 25 20:00:45 2014 +0200 @@ -73,13 +73,14 @@ return fractions; } - public Fraction getFractionByName(String name) { + public List<Fraction> getFractionsByName(String name) { + List<Fraction> result = new ArrayList<Fraction>(); for (Fraction fraction: fractions) { if (fraction.getName().equals(name)) { - return fraction; + result.add(fraction); } } - return null; + return result.isEmpty() ? null : result; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :