[PATCH 3 of 5] issue1235: sort km when running over them for total sediment load

Wald Commits scm-commit at wald.intevation.org
Fri Jun 28 13:51:29 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372420755 -7200
# Node ID 686bbfeacfe5011f22c2a62272cabbf359d93b3e
# Parent  4f9ad03669777f9ed69b09fe750b3d0cf8f1e275
issue1235: sort km when running over them for total sediment load.

diff -r 4f9ad0366977 -r 686bbfeacfe5 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Jun 28 11:30:35 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Jun 28 13:59:15 2013 +0200
@@ -11,6 +11,7 @@
 import gnu.trove.TDoubleArrayList;
 
 import java.util.ArrayList;
+import java.util.TreeSet;
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -345,7 +346,9 @@
         Range lastSuspRange = null;
         double lastSuspValue = 0d;
 
-        for (double km: load.getKms()) {
+        TreeSet<Double> kms = new TreeSet<Double>(load.getKms());
+
+        for (double km: kms) {
             logger.debug ("Trying to add at km " + km);
             SedimentLoadFraction fraction = load.getFraction(km);
             if (complete(fraction)) {


More information about the Dive4elements-commits mailing list