[Dive4elements-commits] [PATCH 1 of 2] Create and add sieves regardless of the the order of diameter/value

Wald Commits scm-commit at wald.intevation.org
Wed Jan 9 09:29:53 CET 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1357720081 -3600
# Node ID 0df2247d98e1796b9ace7366c86e13c785bb6bde
# Parent  03c824858a4049ec10c582258b0d99611b48db19
Create and add sieves regardless of the the order of diameter/value.

diff -r 03c824858a40 -r 0df2247d98e1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java
--- 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);
             }
         };


More information about the Dive4elements-commits mailing list