[PATCH 4 of 4] Add isValid method for single double arrays

Wald Commits scm-commit at wald.intevation.org
Thu Nov 21 15:40:12 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1385044805 -3600
# Node ID eb4ca9a7eaca5b79d44c4a6656954b081bf53258
# Parent  60a5fc522ec426e6036f95a3dd30a200dae8b704
Add isValid method for single double arrays

diff -r 60a5fc522ec4 -r eb4ca9a7eaca artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Thu Nov 21 15:37:43 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Thu Nov 21 15:40:05 2013 +0100
@@ -218,15 +218,21 @@
 
     public static final boolean isValid(double [][] data) {
         for (double [] ds: data) {
-            for (double d: ds) {
-                if (Double.isNaN(d)) {
-                    return false;
-                }
+            if (!isValid(ds)) {
+                return false;
             }
         }
         return true;
     }
 
+    public static final boolean isValid(double [] data) {
+        for (double d: data) {
+            if (Double.isNaN(d)) {
+                return false;
+            }
+        }
+        return true;
+    }
 
     /** In an array of doubles, search and return the maximum value. */
     public static final double maxInArray(double[] values) {


More information about the Dive4elements-commits mailing list