Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java @ 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 | 913b52064449 |
children | da872168a899 |
comparison
equal
deleted
inserted
replaced
1665:0ebce697adcc | 1666:09c1292cf36d |
---|---|
1 package de.intevation.flys.utils; | 1 package de.intevation.flys.utils; |
2 | |
3 import java.util.Arrays; | |
4 | |
2 | 5 |
3 public class DoubleUtil | 6 public class DoubleUtil |
4 { | 7 { |
5 public static final double DEFAULT_STEP_PRECISION = 1e6; | 8 public static final double DEFAULT_STEP_PRECISION = 1e6; |
6 | 9 |
35 | 38 |
36 if (from > to) { | 39 if (from > to) { |
37 step = -step; | 40 step = -step; |
38 } | 41 } |
39 | 42 |
43 double max = Math.max(from, to); | |
44 | |
40 for (int idx = 0; idx < num; idx++) { | 45 for (int idx = 0; idx < num; idx++) { |
46 if (lower > max) { | |
47 return Arrays.copyOfRange(values, 0, idx); | |
48 } | |
49 | |
41 values[idx] = round(lower, precision); | 50 values[idx] = round(lower, precision); |
42 lower += step; | 51 lower += step; |
43 } | 52 } |
44 | 53 |
45 return values; | 54 return values; |