# HG changeset patch # User Sascha L. Teichmann # Date 1329487494 0 # Node ID 407bbc74fe0b9c4beedeb61087fd08413027bbae # Parent 33e4481933e21976f466e8b3647fa73cf6596ad4 WstValueTable: Symmetrical to getMinMaxW() add two methods to find min/max Q for a given km or a range. flys-artifacts/trunk@4085 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 33e4481933e2 -r 407bbc74fe0b flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Feb 17 11:59:30 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Feb 17 14:04:54 2012 +0000 @@ -1,3 +1,9 @@ +2012-02-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java(getMinMaxQ): + Symmetrical to getMinMaxW() add two methods to find min/max Q for a given + km or a range. The range method is maybe a bit slow. + 2012-02-17 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java(getMinMaxW): diff -r 33e4481933e2 -r 407bbc74fe0b flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java Fri Feb 17 11:59:30 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java Fri Feb 17 14:04:54 2012 +0000 @@ -607,6 +607,32 @@ return ws; } + public double [] getMinMaxQ(double km) { + return getMinMaxQ(km, new double [2]); + } + + public double [] getMinMaxQ(double km, double [] result) { + double minQ = Double.MAX_VALUE; + double maxQ = -Double.MAX_VALUE; + + for (int i = 0; i < columns.length; ++i) { + double q = columns[i].getQRangeTree().findQ(km); + if (!Double.isNaN(q)) { + if (q < minQ) minQ = q; + if (q > maxQ) maxQ = q; + } + } + + if (minQ < Double.MAX_VALUE) { + result[0] = minQ; + result[1] = maxQ; + return result; + } + + return null; + } + + public double [] getMinMaxW(double km) { return getMinMaxW(km, new double [2]);