changeset 7015:a9ff696c2d18

Fixed misuse of x !=/== Double.NaN
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 13 Sep 2013 17:42:09 +0200
parents 56891f61e534
children b9633d6ce57e
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java
diffstat 2 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java	Fri Sep 13 16:10:10 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java	Fri Sep 13 17:42:09 2013 +0200
@@ -977,7 +977,7 @@
 
         for (int col = 0; col < columns.length; col++) {
             qs[col] = columns[col].getQRangeTree().findQ(km);
-            if (startRow.km == km && startRow.ws[col] != Double.NaN) {
+            if (startRow.km == km && !Double.isNaN(startRow.ws[col])) {
                 // Great. W is defined at km.
                 ws[col] = startRow.ws[col];
                 continue;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java	Fri Sep 13 16:10:10 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java	Fri Sep 13 17:42:09 2013 +0200
@@ -193,31 +193,31 @@
     /** Returns true if all fraction values except SuspSediment are unset. */
     public boolean hasOnlySuspValues() {
         return
-            getSuspSediment() != Double.NaN &&
-            getCoarse() == Double.NaN &&
-            getFineMiddle() == Double.NaN &&
-            getSand() == Double.NaN &&
-            getSuspSand() == Double.NaN;
+            !Double.isNaN(getSuspSediment()) &&
+            Double.isNaN(getCoarse()) &&
+            Double.isNaN(getFineMiddle()) &&
+            Double.isNaN(getSand()) &&
+            Double.isNaN(getSuspSand());
     }
 
     /** Returns true if all fraction values except SuspSediment are set. */
     public boolean hasButSuspValues() {
         return
-            getSuspSediment() == Double.NaN &&
-            getCoarse() != Double.NaN &&
-            getFineMiddle() != Double.NaN &&
-            getSand() != Double.NaN &&
-            getSuspSand() != Double.NaN;
+            Double.isNaN(getSuspSediment()) &&
+            !Double.isNaN(getCoarse()) &&
+            !Double.isNaN(getFineMiddle()) &&
+            !Double.isNaN(getSand()) &&
+            !Double.isNaN(getSuspSand());
     }
 
     /** Returns true if all fraction needed for total calculation are set. */
     public boolean isComplete() {
         return
-            getCoarse() != Double.NaN &&
-            getFineMiddle() != Double.NaN &&
-            getSand() != Double.NaN &&
-            getSuspSand() != Double.NaN &&
-            getSuspSediment() != Double.NaN;
+            !Double.isNaN(getCoarse()) &&
+            !Double.isNaN(getFineMiddle()) &&
+            !Double.isNaN(getSand()) &&
+            !Double.isNaN(getSuspSand()) &&
+            !Double.isNaN(getSuspSediment());
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org