comparison flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java @ 4163:2b4f78ccfbaa

Made DoubleUtil.explode() more robust against invalid result array sizes.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 17 Oct 2012 01:12:19 +0200
parents 6d8c7a00e74e
children 64528d2a89c4
comparison
equal deleted inserted replaced
4162:debd1a706469 4163:2b4f78ccfbaa
40 double lower = from; 40 double lower = from;
41 41
42 double diff = to - from; 42 double diff = to - from;
43 double tmp = diff / step; 43 double tmp = diff / step;
44 int num = (int)Math.abs(Math.ceil(tmp)) + 1; 44 int num = (int)Math.abs(Math.ceil(tmp)) + 1;
45
46 if (num < 1) {
47 return new double[0];
48 }
45 49
46 double [] values = new double[num]; 50 double [] values = new double[num];
47 51
48 if (from > to) { 52 if (from > to) {
49 step = -step; 53 step = -step;

http://dive4elements.wald.intevation.org