changeset 489:e960098b1398

Importer: Ignore lines that contain km positions which were found before in the same WST file. flys-backend/trunk@1833 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 05 May 2011 09:45:13 +0000
parents b316d2106598
children 13af9318a4a2
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Thu May 05 06:04:57 2011 +0000
+++ b/flys-backend/ChangeLog	Thu May 05 09:45:13 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-05	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/WstParser.java:
+	  Ignore lines that contain km positions which were found
+	  before in the same file.
+
 2011-05-05  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/River.java: Added a method that
--- a/flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java	Thu May 05 06:04:57 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/WstParser.java	Thu May 05 09:45:13 2011 +0000
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 
 import java.io.File;
 import java.io.IOException;
@@ -90,7 +91,7 @@
 
             String einheit = "Wasserstand [NN + m]";
 
-            //HashMap<String, Double> oldEscapeLine = null;
+            HashSet<BigDecimal> kms = new HashSet<BigDecimal>();
 
             while ((input = in.readLine()) != null) {
                 String line = input;
@@ -231,6 +232,14 @@
 
                     BigDecimal kaem = data[0];
 
+                    if (!kms.add(kaem)) {
+                        log.warn(
+                            "km " + kaem + 
+                            " (line " + in.getLineNumber() + 
+                            ") found more than once. -> ignored");
+                        continue;
+                    }
+
                     if (kaem.compareTo(minKm) < 0) {
                         minKm = kaem;
                     }

http://dive4elements.wald.intevation.org