changeset 1666:09c1292cf36d

Bugfix: #351 Modified determination of single values specified by min/max values and an interval. flys-artifacts/trunk@2874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 30 Sep 2011 14:29:26 +0000
parents 0ebce697adcc
children f1af0c07a6ee
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 30 09:41:22 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 30 14:29:26 2011 +0000
@@ -1,3 +1,12 @@
+2011-09-30  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue351 (W-INFO / Wasserspiegellagenberechnungen)
+
+	* src/main/java/de/intevation/flys/utils/DoubleUtil.java: Modified the
+	  explode() function that returns a list of values specified by min, max
+	  and an interval. If the last value, determined by the interval, is
+	  bigger than the max value, it is not included in the result list.
+
 2011-09-30  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	flys/issue334 (Querprofil-Diagramm: Ausgabe dieses Diagrammtyps
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Fri Sep 30 09:41:22 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Fri Sep 30 14:29:26 2011 +0000
@@ -1,5 +1,8 @@
 package de.intevation.flys.utils;
 
+import java.util.Arrays;
+
+
 public class DoubleUtil
 {
     public static final double DEFAULT_STEP_PRECISION = 1e6;
@@ -37,7 +40,13 @@
             step = -step;
         }
 
+        double max = Math.max(from, to);
+
         for (int idx = 0; idx < num; idx++) {
+            if (lower > max) {
+                return Arrays.copyOfRange(values, 0, idx);
+            }
+
             values[idx] = round(lower, precision);
             lower      += step;
         }

http://dive4elements.wald.intevation.org