[PATCH 2 of 2] issue1436: Exploit validity-rule of sedimentdensities

Wald Commits scm-commit at wald.intevation.org
Wed Aug 28 11:52:38 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1377684176 -7200
# Node ID 4c0222d9405532efbc07a465afb039bb614cb548
# Parent  0a3dd5be6f818865c78b3849aedf987a8d2a14e3
issue1436: Exploit validity-rule of sedimentdensities.

diff -r 0a3dd5be6f81 -r 4c0222d94055 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Wed Aug 28 11:55:14 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java	Wed Aug 28 12:02:56 2013 +0200
@@ -80,14 +80,10 @@
             for (int i = 0; i < years.size() -1; i++) {
                 int y1 = years.get(i);
                 int y2 = years.get(i + 1);
-                int mid = Math.round((y1 + y2) / 2);
-                if (year < mid) {
+                if (year >= y1 && year < y2) {
                     return getDensityAtKm(densities.get(y1), km);
                 }
-                else if (i == years.size() -1) {
-                    continue;
-                }
-                else {
+                else if (year >= y2 && i == years.size() -1) {
                     return getDensityAtKm(densities.get(y2), km);
                 }
             }


More information about the Dive4elements-commits mailing list