changeset 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
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 
     /**

http://dive4elements.wald.intevation.org