Mercurial > dive4elements > river
changeset 5544:12f4d088f088
WST importer: Cosmetics.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 23:16:11 +0200 |
parents | 732a8bd44650 |
children | ed149d5d7fb7 38acd82feeac |
files | flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java |
diffstat | 1 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 21:02:17 2013 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 23:16:11 2013 +0200 @@ -105,8 +105,10 @@ BigDecimal [] aktAbfluesse = null; BigDecimal [] firstAbfluesse = null; - BigDecimal minKm = MAX_RANGE; - BigDecimal maxKm = MIN_RANGE; + BigDecimal minKm = MAX_RANGE; + BigDecimal maxKm = MIN_RANGE; + BigDecimal kmHist1 = null; + BigDecimal kmHist2 = null; boolean columnHeaderChecked = false; @@ -114,8 +116,6 @@ 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 @@ -147,12 +147,10 @@ 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; - } - } + if (kmHist1 != null && kmHist2 != null + && kmHist1.compareTo(kmHist2) < 0) { + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } addInterval(minKm, maxKm, aktAbfluesse); minKm = MAX_RANGE; maxKm = MIN_RANGE; @@ -280,8 +278,8 @@ continue; } - kmHist2 = kmHist1; - kmHist1 = kaem; + kmHist2 = kmHist1; + kmHist1 = kaem; if (kaem.compareTo(minKm) < 0) { minKm = kaem; @@ -330,9 +328,11 @@ } // for all lines in WST file wst.setUnit(new ImportUnit(einheit)); - if (kmHist1.compareTo(kmHist2) < 0) { - BigDecimal t = minKm; minKm = maxKm; maxKm = t; - } + + if (kmHist1 != null && kmHist2 != null + && kmHist1.compareTo(kmHist2) < 0) { + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } addInterval(minKm, maxKm, aktAbfluesse); fixRangesOrder();