[PATCH 2 of 2] Fix binarysearch logic in SedimentLoadData

Wald Commits scm-commit at wald.intevation.org
Fri Aug 15 18:56:12 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1408121762 -7200
# Node ID 786bb4f87e8dbceec61254eb35fed3f2893d9a68
# Parent  e60ba70906679d365006a0ff400810697760a498
Fix binarysearch logic in SedimentLoadData

diff -r e60ba7090667 -r 786bb4f87e8d artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Fri Aug 15 18:42:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Fri Aug 15 18:56:02 2014 +0200
@@ -324,8 +324,8 @@
                 int mid = (lo + hi)/2;
                 Value v = values.get(mid);
                 int xid = v.getLoad().getId();
-                if      (xid < id) hi = mid-1;
-                else if (xid > id) lo = mid+1;
+                if      (xid > id) hi = mid-1;
+                else if (xid < id) lo = mid+1;
                 else return v.getValue();
             }
 


More information about the Dive4Elements-commits mailing list