[Dive4elements-commits] [PATCH 2 of 4] issue1267: Sort the list of FastCrossSections before binarySearching it

Wald Commits scm-commit at wald.intevation.org
Tue Jun 11 11:54:39 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1370944765 -7200
# Node ID c297a61115d073b432d687b3d5b882789d0630f1
# Parent  29d6cdcc7e38ba72dfdbd9cb25d04abb5c0e48b7
issue1267: Sort the list of FastCrossSections before binarySearching it.

diff -r 29d6cdcc7e38 -r c297a61115d0 artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 11:58:54 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 11:59:25 2013 +0200
@@ -56,6 +56,7 @@
     /** Finds the FastCrossSectionLine at km (null if not found). */
     public FastCrossSectionLine getCrossSectionLine(double km) {
         FastCrossSectionLine key = new FastCrossSectionLine(km);
+        Collections.sort(crossSectionLines, FastCrossSectionLine.KM_CMP);
         int pos = Collections.binarySearch(
             crossSectionLines, key, FastCrossSectionLine.KM_CMP);
         return pos < 0 ? null : crossSectionLines.get(pos);


More information about the Dive4elements-commits mailing list