# HG changeset patch # User Sascha L. Teichmann # Date 1365004751 -7200 # Node ID b09c095a0b7ece4ec56daf97298f1d156eddb544 # Parent 25c2505df28fc6b7de1c1c5b0141fa8774136162 WST Importer: Potential fix for tighten gaps between Q ranges. diff -r 25c2505df28f -r b09c095a0b7e flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java --- 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)); } }