comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java @ 6270:44ee7d26eb18

issue1267: Polishing: Move the sorting into the db/sql-query.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 11 Jun 2013 12:19:01 +0200
parents 484a19628b1e
children 5f4893db41e4
comparison
equal deleted inserted replaced
6269:5b1cc816fcdb 6270:44ee7d26eb18
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 // TODO follwing is braindead. Create the list in sorted fashion
60 // instead and remove sorting here.
61 Collections.sort(crossSectionLines, FastCrossSectionLine.KM_CMP);
62 int pos = Collections.binarySearch( 59 int pos = Collections.binarySearch(
63 crossSectionLines, key, FastCrossSectionLine.KM_CMP); 60 crossSectionLines, key, FastCrossSectionLine.KM_CMP);
64 return pos < 0 ? null : crossSectionLines.get(pos); 61 return pos < 0 ? null : crossSectionLines.get(pos);
65 } 62 }
66 63

http://dive4elements.wald.intevation.org