comparison backend/src/main/java/org/dive4elements/river/model/River.java @ 8756:26dedebbe39f

(issue1801) Code cleanups Remove one indirecton level around RiverUtils.getGauge and remove the old and now unused determineGauge method.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 15:49:23 +0200
parents 30b1ddadf275
children d5917ff74d8a
comparison
equal deleted inserted replaced
8755:30b1ddadf275 8756:26dedebbe39f
354 } 354 }
355 355
356 return minmax; 356 return minmax;
357 } 357 }
358 358
359
360 /**
361 * This method returns the first gauge that is intersected by <i>a</i> and
362 * <i>b</i>, but which possibly does not ends with a or starts with b.
363 *
364 * @param a A start point.
365 * @param b An end point.
366 *
367 * @return the first intersecting gauge that does not border with a or b,
368 * the first intersecting gauge if that is impossible.
369 */
370 public Gauge determineGauge(double a, double b) {
371 List<Gauge> gauges = determineGauges(a, b);
372
373 if (a > b) {
374 for (int i = gauges.size() - 1; i >= 0; i--) {
375 Gauge g = gauges.get(i);
376 if (KM_CMP.compare(g.getRange().getA().doubleValue(), a) == 0)
377 continue;
378 return g;
379 }
380 }
381
382 for (Gauge g: gauges) {
383 if (KM_CMP.compare(g.getRange().getB().doubleValue(), a) == 0) {
384 continue;
385 }
386 return g;
387 }
388
389 return null;
390 }
391
392 /** 359 /**
393 * Determine reference gauge dependent on direction of calculation 360 * Determine reference gauge dependent on direction of calculation
394 * for a range calculation, otherwise dependent on flow direction. 361 * for a range calculation, otherwise dependent on flow direction.
395 */ 362 */
396 public Gauge determineRefGauge(double[] range, boolean isRange) { 363 public Gauge determineRefGauge(double[] range, boolean isRange) {

http://dive4elements.wald.intevation.org