[Dive4elements-commits] [PATCH 2 of 3] issue1335: Set a single (0) QRange for Waterlevel diffs from csv

Wald Commits scm-commit at wald.intevation.org
Thu Jun 13 09:03:00 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1371100355 -7200
# Node ID 6cdafb6feee17dfce3fce6f83c21284aaba3171c
# Parent  550cb41d37d9ab5d0a1f43529b15355d2272f3ab
issue1335: Set a single (0) QRange for Waterlevel diffs from csv.

diff -r 550cb41d37d9 -r 6cdafb6feee1 backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java	Wed Jun 12 12:36:43 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportWstQRange.java	Thu Jun 13 07:12:35 2013 +0200
@@ -37,6 +37,15 @@
         this.q     = q;
     }
 
+    public ImportWstQRange(
+        BigDecimal a,
+        BigDecimal b,
+        BigDecimal q
+    ) {
+        this.range = new ImportRange(a, b);
+        this.q     = q;
+    }
+
     public ImportRange getRange() {
         return range;
     }
diff -r 550cb41d37d9 -r 6cdafb6feee1 backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Wed Jun 12 12:36:43 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Thu Jun 13 07:12:35 2013 +0200
@@ -24,7 +24,9 @@
 import org.dive4elements.river.importer.ImportUnit;
 
 import org.dive4elements.river.importer.ImportWst;
+import org.dive4elements.river.importer.ImportWstQRange;
 import org.dive4elements.river.importer.ImportWstColumn;
+import org.dive4elements.river.importer.ImportWstColumnValue;
 
 
 /**
@@ -95,6 +97,17 @@
             differences.add(current);
         }
 
+        // For all differences columns, add a single Q-Range with
+        // 0.
+        for (ImportWstColumn column: columns) {
+            List<ImportWstColumnValue> cValues = column.getColumnValues();
+            column.addColumnQRange(
+                new ImportWstQRange(
+                    cValues.get(0).getPosition(),
+                    cValues.get(cValues.size() - 1).getPosition(),
+                    new BigDecimal(0d))
+                );
+        }
         current = null;
         columns = null;
     }


More information about the Dive4elements-commits mailing list