changeset 6966:328854c0467f

SedimentLoadFactory: Further code simplification.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 05 Sep 2013 15:28:59 +0200
parents 69bf96202df4
children 3a987e9af256
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Thu Sep 05 15:27:56 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Thu Sep 05 15:28:59 2013 +0200
@@ -492,21 +492,19 @@
     ) {
         MeasurementStation station = stations.get(km);
         MeasurementStation nextStation = null;
-        if (stations.ceilingEntry(km + 0.1d) != null) {
-            nextStation = stations.ceilingEntry(km + 0.1d).getValue();
-        }
         if (station == null) {
             return null;
         }
+        if (stations.ceilingEntry(km + 0.1d) != null) {
+            nextStation = stations.ceilingEntry(km + 0.1d).getValue();
+        }
+        if (nextStation != null)
+            return new Range(station.getRange().getA().doubleValue(),
+                nextStation.getRange().getA().doubleValue());
         else {
-            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());
-            }
+            // TODO end-of-river instead of B.
+            return new Range(station.getRange().getA().doubleValue(),
+                station.getRange().getB().doubleValue());
         }
     }
 

http://dive4elements.wald.intevation.org