comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java @ 9375:a0a2e68a1e11

Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
author mschaefer
date Fri, 03 Aug 2018 17:00:45 +0200
parents 6f7e92c16050
children 8ae7137b67d7
comparison
equal deleted inserted replaced
9374:4d61a9642046 9375:a0a2e68a1e11
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.uinfo.salix; 10 package org.dive4elements.river.artifacts.uinfo.salix;
11 11
12 import java.math.BigDecimal;
12 import java.util.ArrayList; 13 import java.util.ArrayList;
13 import java.util.HashMap; 14 import java.util.HashMap;
14 import java.util.List; 15 import java.util.List;
15 import java.util.Map; 16 import java.util.Map;
16 import java.util.Map.Entry; 17 import java.util.Map.Entry;
40 * 41 *
41 * @author Matthias Schäfer 42 * @author Matthias Schäfer
42 */ 43 */
43 final class SalixLineCalculator { 44 final class SalixLineCalculator {
44 45
46 private static final BigDecimal SALIX_DISTANCE = new BigDecimal("2.31");
45 private final List<ResultRow> rows = new ArrayList<>(); 47 private final List<ResultRow> rows = new ArrayList<>();
46 48
47 private final RiverInfoProvider riverInfoProvider; 49 private final RiverInfoProvider riverInfoProvider;
48 50
49 private final Map<Gauge, QPosition> gaugeMwPos; 51 private final Map<Gauge, QPosition> gaugeMwPos;
179 181
180 /** 182 /**
181 * Calculates the salix value 183 * Calculates the salix value
182 */ 184 */
183 private double calcSalix(final double mhw, final double mw) { 185 private double calcSalix(final double mhw, final double mw) {
184 return Formatter.roundW(mhw) - 2.31 - Formatter.roundW(mw); 186 return Formatter.roundW(mhw).subtract(SALIX_DISTANCE).subtract(Formatter.roundW(mw)).doubleValue();
185 } 187 }
186 188
187 /** 189 /**
188 * Calculates the inverse MW-MNW difference 190 * Calculates the inverse MW-MNW difference
189 */ 191 */
190 private double calcMwmnw(final double mw, final double mnw) { 192 private double calcMwmnw(final double mw, final double mnw) {
191 return Formatter.roundW(mnw) - Formatter.roundW(mw); 193 return Formatter.roundW(mnw).subtract(Formatter.roundW(mw)).doubleValue();
192 } 194 }
193 195
194 /** 196 /**
195 * Gets the station-specific list of delta-ws of the active scenario, at least with one 0 item in any case 197 * Gets the station-specific list of delta-ws of the active scenario, at least with one 0 item in any case
196 */ 198 */

http://dive4elements.wald.intevation.org