# HG changeset patch # User Felix Wolfsteller # Date 1378387918 -7200 # Node ID 3a987e9af2561228e89fb9e52832872489f6f5d9 # Parent 328854c0467f5730fc87081958d8137e33abdc20 SedimentLoadFactory: Improved readability. diff -r 328854c0467f -r 3a987e9af256 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Thu Sep 05 15:28:59 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Thu Sep 05 15:31:58 2013 +0200 @@ -491,21 +491,24 @@ double km ) { MeasurementStation station = stations.get(km); - MeasurementStation nextStation = null; if (station == null) { return null; } + + double endKm; + if (stations.ceilingEntry(km + 0.1d) != null) { - nextStation = stations.ceilingEntry(km + 0.1d).getValue(); + MeasurementStation nextStation = stations.ceilingEntry(km + 0.1d).getValue(); + endKm = nextStation.getRange().getA().doubleValue(); } - if (nextStation != null) - return new Range(station.getRange().getA().doubleValue(), - nextStation.getRange().getA().doubleValue()); else { // TODO end-of-river instead of B. - return new Range(station.getRange().getA().doubleValue(), - station.getRange().getB().doubleValue()); + endKm = station.getRange().getB().doubleValue(); } + + return new Range( + station.getRange().getA().doubleValue(), + endKm); } /**