Mercurial > dive4elements > river
changeset 5543:732a8bd44650
Wst Parser: Yet another attempt to fix the order of the Q ranges (made by S. Teichmann)
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 21:02:17 +0200 |
parents | f3b270e5462e |
children | 12f4d088f088 |
files | flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 20:16:01 2013 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 21:02:17 2013 +0200 @@ -114,6 +114,8 @@ HashSet<BigDecimal> kms = new HashSet<BigDecimal>(); + BigDecimal kmHist1 = null, kmHist2 = null; + while ((input = in.readLine()) != null) { String line = input; if (first) { // fetch number of columns @@ -145,6 +147,12 @@ parseLineAsDouble(line, columnCount, false, true); if (aktAbfluesse != null) { + if (kmHist1 != null && kmHist2 != null) { + if (kmHist1.compareTo(kmHist2) < 0) { + log.debug("swapped"); + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } + } addInterval(minKm, maxKm, aktAbfluesse); minKm = MAX_RANGE; maxKm = MIN_RANGE; @@ -272,6 +280,9 @@ continue; } + kmHist2 = kmHist1; + kmHist1 = kaem; + if (kaem.compareTo(minKm) < 0) { minKm = kaem; } @@ -319,7 +330,9 @@ } // for all lines in WST file wst.setUnit(new ImportUnit(einheit)); - + if (kmHist1.compareTo(kmHist2) < 0) { + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } addInterval(minKm, maxKm, aktAbfluesse); fixRangesOrder();