[PATCH 4 of 7] SedimentLoadFactory: Further code simplification

Wald Commits scm-commit at wald.intevation.org
Thu Sep 5 15:37:49 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1378387739 -7200
# Node ID 328854c0467f5730fc87081958d8137e33abdc20
# Parent  69bf96202df4b4751e874b06e61ac6f5e6c86f70
SedimentLoadFactory: Further code simplification.

diff -r 69bf96202df4 -r 328854c0467f 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: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 (station == null) {
+            return null;
+        }
         if (stations.ceilingEntry(km + 0.1d) != null) {
             nextStation = stations.ceilingEntry(km + 0.1d).getValue();
         }
-        if (station == null) {
-            return null;
-        }
+        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());
         }
     }
 


More information about the Dive4elements-commits mailing list