comparison artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java @ 7594:eb4ca9a7eaca

Add isValid method for single double arrays
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 21 Nov 2013 15:40:05 +0100
parents 898afcce1d0a
children 72760ca2fc2b
comparison
equal deleted inserted replaced
7593:60a5fc522ec4 7594:eb4ca9a7eaca
216 } 216 }
217 } 217 }
218 218
219 public static final boolean isValid(double [][] data) { 219 public static final boolean isValid(double [][] data) {
220 for (double [] ds: data) { 220 for (double [] ds: data) {
221 for (double d: ds) { 221 if (!isValid(ds)) {
222 if (Double.isNaN(d)) { 222 return false;
223 return false;
224 }
225 } 223 }
226 } 224 }
227 return true; 225 return true;
228 } 226 }
229 227
228 public static final boolean isValid(double [] data) {
229 for (double d: data) {
230 if (Double.isNaN(d)) {
231 return false;
232 }
233 }
234 return true;
235 }
230 236
231 /** In an array of doubles, search and return the maximum value. */ 237 /** In an array of doubles, search and return the maximum value. */
232 public static final double maxInArray(double[] values) { 238 public static final double maxInArray(double[] values) {
233 double max = - Double.MAX_VALUE; 239 double max = - Double.MAX_VALUE;
234 for (double d: values) { 240 for (double d: values) {

http://dive4elements.wald.intevation.org