[Dive4elements-commits] [PATCH 1 of 4] In prep for 1235: Renamed variables for improved readability

Wald Commits scm-commit at wald.intevation.org
Fri Jun 14 17:02:49 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1371203778 -7200
# Node ID fbe2d4c2b2dd6862973e66f3d26d920a431a802b
# Parent  aef238fdd9b6194d73ee9a1085d18b4d521af333
In prep for 1235: Renamed variables for improved readability.

diff -r aef238fdd9b6 -r fbe2d4c2b2dd artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Fri Jun 14 16:56:30 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Fri Jun 14 11:56:18 2013 +0200
@@ -94,13 +94,13 @@
         double[][] sd = getLoadData(result);
 
         // Sort by km.
-        TreeMap<Double, Double> sortData = new TreeMap<Double,Double>();
+        TreeMap<Double, Double> sortedKmLoad = new TreeMap<Double,Double>();
 
         double[] km   = sd[0];
         double[] load = sd[1];
 
         for (int i = 0 ; i < km.length; i++) {
-            sortData.put(km[i], load[i]);
+            sortedKmLoad.put(km[i], load[i]);
         }
 
         double[][] values = new double[2][];
@@ -112,25 +112,25 @@
         // Find station via its station (km).
         // TODO use a binarySearch instead of linear absdiff approach
         int i = 0;
-        for (Map.Entry<Double, Double> entry: sortData.entrySet()) {
+        for (Map.Entry<Double, Double> kmLoad: sortedKmLoad.entrySet()) {
             boolean matchFound = false;
             // For now, ignore overlaps like (B> next A)
             for (MeasurementStation station: stations) {
-                if (Math.abs(station.getStation() - entry.getKey()) < EPSILON ||
-                    station.getRange().containsTolerant(entry.getKey())) {
+                if (Math.abs(station.getStation() - kmLoad.getKey()) < EPSILON ||
+                    station.getRange().containsTolerant(kmLoad.getKey())) {
                     // TODO: In rare cases, two matches can be found.
                     values[0][i*3] = station.getRange().getA().doubleValue() + EPSILON;
-                    values[1][i*3] = entry.getValue();
+                    values[1][i*3] = kmLoad.getValue();
                     values[0][i*3+1] = station.getRange().getB().doubleValue() - EPSILON;
-                    values[1][i*3+1] = entry.getValue();
+                    values[1][i*3+1] = kmLoad.getValue();
                     values[0][i*3+2] = station.getRange().getB().doubleValue();
-                    values[1][i*3+2] = entry.getValue();
+                    values[1][i*3+2] = kmLoad.getValue();
                     matchFound = true;
                 }
             }
             // Store points without match for later assessment.
             if (!matchFound) {
-                logger.warn("measurement without station ("+entry.getKey()+")!");
+                logger.warn("measurement without station ("+kmLoad.getKey()+")!");
             }
             i++;
         }


More information about the Dive4elements-commits mailing list