Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java @ 6266:c297a61115d0
issue1267: Sort the list of FastCrossSections before binarySearching it.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 11 Jun 2013 11:59:25 +0200 |
parents | 29d6cdcc7e38 |
children | 484a19628b1e |
comparison
equal
deleted
inserted
replaced
6265:29d6cdcc7e38 | 6266:c297a61115d0 |
---|---|
54 } | 54 } |
55 | 55 |
56 /** Finds the FastCrossSectionLine at km (null if not found). */ | 56 /** Finds the FastCrossSectionLine at km (null if not found). */ |
57 public FastCrossSectionLine getCrossSectionLine(double km) { | 57 public FastCrossSectionLine getCrossSectionLine(double km) { |
58 FastCrossSectionLine key = new FastCrossSectionLine(km); | 58 FastCrossSectionLine key = new FastCrossSectionLine(km); |
59 Collections.sort(crossSectionLines, FastCrossSectionLine.KM_CMP); | |
59 int pos = Collections.binarySearch( | 60 int pos = Collections.binarySearch( |
60 crossSectionLines, key, FastCrossSectionLine.KM_CMP); | 61 crossSectionLines, key, FastCrossSectionLine.KM_CMP); |
61 return pos < 0 ? null : crossSectionLines.get(pos); | 62 return pos < 0 ? null : crossSectionLines.get(pos); |
62 } | 63 } |
63 | 64 |