comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumn.java @ 2615:b0597a63fe70

More code for the fixings km chart service. flys-artifacts/trunk@4199 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 04 Apr 2012 18:30:44 +0000
parents 3c907758f0ab
children 6ed24efc80de
comparison
equal deleted inserted replaced
2614:036e234c2385 2615:b0597a63fe70
31 31
32 public int getColumnId() { 32 public int getColumnId() {
33 return columnId; 33 return columnId;
34 } 34 }
35 35
36 public double getW(double km) { 36 public boolean getW(double km, double [] w) {
37 37
38 if (km < kms[0] || km > kms[kms.length-1]) { 38 if (km < kms[0] || km > kms[kms.length-1]) {
39 return Double.NaN; 39 w[0] = Double.NaN;
40 return true;
40 } 41 }
41 42
42 int idx = Arrays.binarySearch(kms, km); 43 int idx = Arrays.binarySearch(kms, km);
43 44
44 if (idx >= 0) return ws[idx]; 45 if (idx >= 0) {
46 w[0] = ws[idx];
47 return true;
48 }
45 49
46 idx = -idx - 1; 50 idx = -idx - 1;
47 51
48 return Linear.linear(km, kms[idx], kms[idx+1], ws[idx], ws[idx+1]); 52 w[0] = Linear.linear(km, kms[idx], kms[idx+1], ws[idx], ws[idx+1]);
53 return false;
49 } 54 }
50 55
51 public double getQ(double km) { 56 public double getQ(double km) {
52 return qs.findQ(km); 57 return qs.findQ(km);
53 } 58 }

http://dive4elements.wald.intevation.org