Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/River.java @ 8755:30b1ddadf275
(issue1801) Unify reference gauge finding code
The basic way as described in the method comment of the
determineRefGauge method is now used in the WINFOArtifact,
MainValuesService and RiverUtils.getGauge method.
RiverUtils.getGauge previously just returned the first
gauge found. While this is now a behavior change I believe
that it is always more correct then the undeterministic
behavior of the previous implmenentation.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 24 Jun 2015 14:07:26 +0200 |
parents | 20b543616e6d |
children | 26dedebbe39f |
comparison
equal
deleted
inserted
replaced
8754:574f8b80799f | 8755:30b1ddadf275 |
---|---|
388 | 388 |
389 return null; | 389 return null; |
390 } | 390 } |
391 | 391 |
392 /** | 392 /** |
393 * Determine reference gauge dependent on direction of calculation | |
394 * for a range calculation, otherwise dependent on flow direction. | |
395 */ | |
396 public Gauge determineRefGauge(double[] range, boolean isRange) { | |
397 if (isRange) { | |
398 return determineGaugeByPosition( | |
399 range[0], | |
400 range[0] > range[1]); | |
401 } | |
402 else { | |
403 return determineGaugeByPosition(range[0]); | |
404 } | |
405 } | |
406 | |
407 /** | |
393 * Returns the min and max distance of this river. The first position in the | 408 * Returns the min and max distance of this river. The first position in the |
394 * resulting array contains the min distance, the second position the max | 409 * resulting array contains the min distance, the second position the max |
395 * distance. | 410 * distance. |
396 * | 411 * |
397 * @return the min and max distance of this river. | 412 * @return the min and max distance of this river. |