Mercurial > dive4elements > river
changeset 4789:0df2247d98e1
Create and add sieves regardless of the the order of diameter/value.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 09 Jan 2013 09:28:01 +0100 |
parents | 03c824858a40 |
children | cd9540bd8040 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java |
diffstat | 1 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Tue Jan 08 17:20:34 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Wed Jan 09 09:28:01 2013 +0100 @@ -144,15 +144,20 @@ continue; } String alias = aliases[i]; - if (alias.startsWith("SIEB")) { - Sieve s = new Sieve((Double)value, 0d); - sieves[index(alias)] = s; - } - else if (alias.startsWith("RSIEB")) { - Sieve s = sieves[index(alias)]; - if (s != null) { - s.setLoad((Double)value); - validSieves.add(s); + if (alias.startsWith("SIEB") + || alias.startsWith("RSIEB")) { + int idx = index(alias); + Sieve s = sieves[idx]; + double v = (Double)value; + if (s == null) { + s = new Sieve(); + sieves[idx] = s; + } + if (alias.startsWith("SIEB")) { + s.setDiameter(v); + } + else { + s.setLoad(v); } } else if (alias.equals("REST")) { @@ -162,8 +167,13 @@ else { map.put(alias, value); } + } - + for (Sieve s: sieves) { + if (s != null) { + validSieves.add(s); + } + } return new Measurement(map, validSieves); } };