changeset 7012:9f45c17e8fda

issue1465: Initialize sediment load fraction values with NaN instead of 0, to symbolize 'no measurement'.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 13 Sep 2013 16:03:05 +0200
parents b1fadc5af121
children 998a9710007e
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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. */

http://dive4elements.wald.intevation.org