Mercurial > dive4elements > river
changeset 5541:b09c095a0b7e
WST Importer: Potential fix for tighten gaps between Q ranges.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 17:59:11 +0200 |
parents | 25c2505df28f |
children | f3b270e5462e |
files | flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 16:00:21 2013 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 17:59:11 2013 +0200 @@ -52,8 +52,7 @@ public static final Pattern UNIT = Pattern.compile("[^\\[]*\\[([^]]+)\\].*"); - public static final BigDecimal INTERVAL_GAP = - new BigDecimal(0.00001); + public static final double INTERVAL_GAP = 0.00001d; protected ImportWst wst; @@ -372,16 +371,15 @@ // still work. if (lastRange != null) { - double d1 = Math.abs( - lastRange.getB().doubleValue() - range.getA().doubleValue()); - double d2 = Math.abs( - range.getB().doubleValue() - lastRange.getA().doubleValue()); + double a1 = lastRange.getA().doubleValue(); + double b1 = lastRange.getB().doubleValue(); + double a2 = range.getA().doubleValue(); - if (d1 < d2) { - lastRange.setB(range.getA().subtract(INTERVAL_GAP)); + if (a1 < b1) { + lastRange.setB(new BigDecimal(a2 - INTERVAL_GAP)); } - else { - range.setA(lastRange.getB().subtract(INTERVAL_GAP)); + else { // a1 >= b1 + lastRange.setB(new BigDecimal(a2 + INTERVAL_GAP)); } }