[PATCH 1 of 2] Backed out changeset 6b9402377d07

Wald Commits scm-commit at wald.intevation.org
Wed Sep 11 09:49:24 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1378885571 -7200
# Node ID 77f48c104d23c98c74f80e78bf42b49363d691d5
# Parent  93e7f947f6fa309ff148f51b606cdbc0a0bf4f73
Backed out changeset 6b9402377d07

diff -r 93e7f947f6fa -r 77f48c104d23 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	Tue Sep 10 17:48:48 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Wed Sep 11 09:46:11 2013 +0200
@@ -13,7 +13,6 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 import java.util.TreeMap;
 
 import net.sf.ehcache.Cache;
@@ -487,46 +486,19 @@
         return new SedimentLoad();
     }
 
-
-    /**
-     * Returns range of matching measurementstation.
-     * If no direct match is found, the measurement-station with
-     * the next lower station is taken - but only if km is still in
-     * its range.
-     *
-     * The end of the range is the beginning of the next range (next as in
-     * next greater station), or if it is the last, by its own ranges end.
-     *
-     * @param stations Map of station to measurementstation (attention:
-     *                 the range of a m.station does not necessarily
-     *                 begin at the registered station).
-     * @param km       The station for which to find a measurementstation.
-     *
-     * @return The validity range of a station (interereted as described above
-     *         for given km or null if none found.
-     */
     protected static Range findMeasurementStationRange(
         TreeMap<Double, MeasurementStation> stations,
         double km
     ) {
-        Map.Entry<Double, MeasurementStation> entry = stations.floorEntry(km);
-        if (entry == null) {
-            return null;
-        }
-        MeasurementStation station = entry.getValue();
-        if (station == null
-        || station.getRange() == null
-        || !station.getRange().contains(km)) {
+        MeasurementStation station = stations.get(km);
+        if (station == null) {
             return null;
         }
 
         double endKm;
 
-        Map.Entry<Double, MeasurementStation> ceilingEntry =
-            stations.ceilingEntry(km + 0.1d);
-
-        if (ceilingEntry != null) {
-            MeasurementStation nextStation = ceilingEntry.getValue();
+        if (stations.ceilingEntry(km + 0.1d) != null) {
+            MeasurementStation nextStation = stations.ceilingEntry(km + 0.1d).getValue();
             endKm = nextStation.getRange().getA().doubleValue();
         }
         else {
@@ -539,7 +511,6 @@
             endKm);
     }
 
-
     /**
      * Run query with grain parameter set to fraction, feed result into
      * load. Create load if null.


More information about the Dive4elements-commits mailing list