[Dive4elements-commits] [PATCH 3 of 4] PRFParser: Re-enable line skipping. Act so on station change

Wald Commits scm-commit at wald.intevation.org
Tue May 14 07:57:28 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1368462781 -7200
# Node ID e514cab94026d8f9115847f7b0f7860b7ad337fc
# Parent  2132c4b70cf9da058d9bc25578f698c836f4e92d
PRFParser: Re-enable line skipping. Act so on station change.

diff -r 2132c4b70cf9 -r e514cab94026 backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java	Mon May 13 17:58:17 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java	Mon May 13 18:33:01 2013 +0200
@@ -342,7 +342,15 @@
                 return false;
             }
 
+            int skip = lineSkipCount;
+
             while ((line = in.readLine()) != null) {
+                // Expecting dummy lines.
+                if (skip > 0) {
+                    skip--;
+                    continue;
+                }
+
                 double km;
                 try {
                     km = kmFormat.extractKm(line);
@@ -356,10 +364,14 @@
 
                 List<XY> kmData = data.get(station);
 
+                // When the station changed we know we are expecting skip/dummy lines.
                 if (kmData == null) {
                     //log.debug("found new km: " + station);
                     kmData = new ArrayList<XY>();
                     data.put(station, kmData);
+                    // When a station change occurs, dummy lines will occur, too.
+                    skip = lineSkipCount;
+                    continue;
                 }
 
                 dataFormat.extractData(line, kmData);


More information about the Dive4elements-commits mailing list