Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java @ 6967:3a987e9af256
SedimentLoadFactory: Improved readability.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 05 Sep 2013 15:31:58 +0200 |
parents | 328854c0467f |
children | 6b9402377d07 |
comparison
equal
deleted
inserted
replaced
6966:328854c0467f | 6967:3a987e9af256 |
---|---|
489 protected static Range findMeasurementStationRange( | 489 protected static Range findMeasurementStationRange( |
490 TreeMap<Double, MeasurementStation> stations, | 490 TreeMap<Double, MeasurementStation> stations, |
491 double km | 491 double km |
492 ) { | 492 ) { |
493 MeasurementStation station = stations.get(km); | 493 MeasurementStation station = stations.get(km); |
494 MeasurementStation nextStation = null; | |
495 if (station == null) { | 494 if (station == null) { |
496 return null; | 495 return null; |
497 } | 496 } |
497 | |
498 double endKm; | |
499 | |
498 if (stations.ceilingEntry(km + 0.1d) != null) { | 500 if (stations.ceilingEntry(km + 0.1d) != null) { |
499 nextStation = stations.ceilingEntry(km + 0.1d).getValue(); | 501 MeasurementStation nextStation = stations.ceilingEntry(km + 0.1d).getValue(); |
500 } | 502 endKm = nextStation.getRange().getA().doubleValue(); |
501 if (nextStation != null) | 503 } |
502 return new Range(station.getRange().getA().doubleValue(), | |
503 nextStation.getRange().getA().doubleValue()); | |
504 else { | 504 else { |
505 // TODO end-of-river instead of B. | 505 // TODO end-of-river instead of B. |
506 return new Range(station.getRange().getA().doubleValue(), | 506 endKm = station.getRange().getB().doubleValue(); |
507 station.getRange().getB().doubleValue()); | 507 } |
508 } | 508 |
509 return new Range( | |
510 station.getRange().getA().doubleValue(), | |
511 endKm); | |
509 } | 512 } |
510 | 513 |
511 /** | 514 /** |
512 * Run query with grain parameter set to fraction, feed result into | 515 * Run query with grain parameter set to fraction, feed result into |
513 * load. Create load if null. | 516 * load. Create load if null. |