Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelData.java @ 8964:45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
author | gernotbelger |
---|---|
date | Thu, 29 Mar 2018 15:48:17 +0200 |
parents | cef37cc093f2 |
children | 392745cccede |
comparison
equal
deleted
inserted
replaced
8963:b98fbd91f64a | 8964:45f1ad66560e |
---|---|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.states; | 10 package org.dive4elements.river.artifacts.states; |
11 | 11 |
12 import org.apache.commons.lang.math.DoubleRange; | |
12 import org.dive4elements.river.artifacts.model.WKms; | 13 import org.dive4elements.river.artifacts.model.WKms; |
14 | |
15 import gnu.trove.TDoubleArrayList; | |
13 | 16 |
14 /** | 17 /** |
15 * Represents a waterlevel fetched with the {@link WaterlevelFetcher}. | 18 * Represents a waterlevel fetched with the {@link WaterlevelFetcher}. |
16 * | 19 * |
17 * @author Gernot Belger | 20 * @author Gernot Belger |
67 } | 70 } |
68 | 71 |
69 public int getYear() { | 72 public int getYear() { |
70 return this.year; | 73 return this.year; |
71 } | 74 } |
75 | |
76 public boolean covers(final DoubleRange simulationRange) { | |
77 | |
78 final TDoubleArrayList allKms = this.wkms.allKms(); | |
79 | |
80 if (allKms.isEmpty()) | |
81 return false; | |
82 | |
83 final double min = allKms.min(); | |
84 if (min > simulationRange.getMaximumDouble()) | |
85 return false; | |
86 | |
87 final double max = allKms.max(); | |
88 if (max < simulationRange.getMinimumDouble()) | |
89 return false; | |
90 | |
91 return true; | |
92 } | |
72 } | 93 } |