[PATCH 2 of 4] issue1465: Initialize sediment load fraction values with NaN instead of 0,

Wald Commits scm-commit at wald.intevation.org
Fri Sep 13 16:01:28 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1379080985 -7200
# Node ID 9f45c17e8fdab4de9fcf91af39c206ace698ed02
# Parent  b1fadc5af121dfe5ca36cbe723da369486ecf439
issue1465: Initialize sediment load fraction values with NaN instead of 0,
to symbolize 'no measurement'.

diff -r b1fadc5af121 -r 9f45c17e8fda artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java	Fri Sep 13 16:01:11 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java	Fri Sep 13 16:03:05 2013 +0200
@@ -36,14 +36,14 @@
     Range unknownRange;
 
     public SedimentLoadFraction() {
-        sand = 0d;
-        fineMiddle = 0d;
-        coarse = 0d;
-        suspSand = 0d;
-        suspSandBed = 0d;
-        suspSediment = 0d;
-        loadTotal = 0d;
-        unknown = 0d;
+        sand         = Double.NaN;
+        fineMiddle   = Double.NaN;
+        coarse       = Double.NaN;
+        suspSand     = Double.NaN;
+        suspSandBed  = Double.NaN;
+        suspSediment = Double.NaN;
+        loadTotal    = Double.NaN;
+        unknown      = Double.NaN;
     }
 
     public double getSand() {
@@ -193,21 +193,21 @@
     /** Returns true if all fraction values except SuspSediment are unset. */
     public boolean hasOnlySuspValues() {
         return
-            getSuspSediment() != 0d &&
-            getCoarse() == 0d &&
-            getFineMiddle() == 0d &&
-            getSand() == 0d &&
-            getSuspSand() == 0d;
+            getSuspSediment() != Double.NaN &&
+            getCoarse() == Double.NaN &&
+            getFineMiddle() == Double.NaN &&
+            getSand() == Double.NaN &&
+            getSuspSand() == Double.NaN;
     }
 
     /** Returns true if all fraction values except SuspSediment are set. */
     public boolean hasButSuspValues() {
         return
-            getSuspSediment() == 0d &&
-            getCoarse() != 0d &&
-            getFineMiddle() != 0d &&
-            getSand() != 0d &&
-            getSuspSand() != 0d;
+            getSuspSediment() == Double.NaN &&
+            getCoarse() != Double.NaN &&
+            getFineMiddle() != Double.NaN &&
+            getSand() != Double.NaN &&
+            getSuspSand() != Double.NaN;
     }
 
     /** Returns true if all fraction needed for total calculation are set. */


More information about the Dive4elements-commits mailing list