comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java @ 380:5f55047a17e8

Moved expensive allocation of result arrays out of km loop. flys-artifacts/trunk@1795 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 02 May 2011 16:28:57 +0000
parents 91fbaa2744bf
children aae8f327425e
comparison
equal deleted inserted replaced
379:c21fb8de54f8 380:5f55047a17e8
347 public WstValueTable(Column [] columns) { 347 public WstValueTable(Column [] columns) {
348 this(); 348 this();
349 this.columns = columns; 349 this.columns = columns;
350 } 350 }
351 351
352
353 public double [] interpolateW(double km, double [] qs) { 352 public double [] interpolateW(double km, double [] qs) {
354 353 return interpolateW(km, qs, new double[qs.length]);
355 double [] ws = new double[qs.length]; 354 }
355
356 public double [] interpolateW(double km, double [] qs, double [] ws) {
356 357
357 int rowIndex = Collections.binarySearch(rows, new Row(km)); 358 int rowIndex = Collections.binarySearch(rows, new Row(km));
358 359
359 if (rowIndex >= 0) { // direct row match 360 if (rowIndex >= 0) { // direct row match
360 Row row = rows.get(rowIndex); 361 Row row = rows.get(rowIndex);

http://dive4elements.wald.intevation.org