Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java @ 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 | 7be97faf5848 |
children | 56891f61e534 |
comparison
equal
deleted
inserted
replaced
7011:b1fadc5af121 | 7012:9f45c17e8fda |
---|---|
34 Range loadTotalRange; | 34 Range loadTotalRange; |
35 Range totalRange; | 35 Range totalRange; |
36 Range unknownRange; | 36 Range unknownRange; |
37 | 37 |
38 public SedimentLoadFraction() { | 38 public SedimentLoadFraction() { |
39 sand = 0d; | 39 sand = Double.NaN; |
40 fineMiddle = 0d; | 40 fineMiddle = Double.NaN; |
41 coarse = 0d; | 41 coarse = Double.NaN; |
42 suspSand = 0d; | 42 suspSand = Double.NaN; |
43 suspSandBed = 0d; | 43 suspSandBed = Double.NaN; |
44 suspSediment = 0d; | 44 suspSediment = Double.NaN; |
45 loadTotal = 0d; | 45 loadTotal = Double.NaN; |
46 unknown = 0d; | 46 unknown = Double.NaN; |
47 } | 47 } |
48 | 48 |
49 public double getSand() { | 49 public double getSand() { |
50 return sand; | 50 return sand; |
51 } | 51 } |
191 } | 191 } |
192 | 192 |
193 /** Returns true if all fraction values except SuspSediment are unset. */ | 193 /** Returns true if all fraction values except SuspSediment are unset. */ |
194 public boolean hasOnlySuspValues() { | 194 public boolean hasOnlySuspValues() { |
195 return | 195 return |
196 getSuspSediment() != 0d && | 196 getSuspSediment() != Double.NaN && |
197 getCoarse() == 0d && | 197 getCoarse() == Double.NaN && |
198 getFineMiddle() == 0d && | 198 getFineMiddle() == Double.NaN && |
199 getSand() == 0d && | 199 getSand() == Double.NaN && |
200 getSuspSand() == 0d; | 200 getSuspSand() == Double.NaN; |
201 } | 201 } |
202 | 202 |
203 /** Returns true if all fraction values except SuspSediment are set. */ | 203 /** Returns true if all fraction values except SuspSediment are set. */ |
204 public boolean hasButSuspValues() { | 204 public boolean hasButSuspValues() { |
205 return | 205 return |
206 getSuspSediment() == 0d && | 206 getSuspSediment() == Double.NaN && |
207 getCoarse() != 0d && | 207 getCoarse() != Double.NaN && |
208 getFineMiddle() != 0d && | 208 getFineMiddle() != Double.NaN && |
209 getSand() != 0d && | 209 getSand() != Double.NaN && |
210 getSuspSand() != 0d; | 210 getSuspSand() != Double.NaN; |
211 } | 211 } |
212 | 212 |
213 /** Returns true if all fraction needed for total calculation are set. */ | 213 /** Returns true if all fraction needed for total calculation are set. */ |
214 public boolean isComplete() { | 214 public boolean isComplete() { |
215 return | 215 return |