comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumn.java @ 2729:a441be7f1589

Added Fix calculation. flys-artifacts/trunk@4462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 22 May 2012 17:09:27 +0000
parents 6ed24efc80de
children fe987587ebc9
comparison
equal deleted inserted replaced
2728:306b9d0f0fb3 2729:a441be7f1589
26 this.ws = ws; 26 this.ws = ws;
27 this.qs = qs; 27 this.qs = qs;
28 } 28 }
29 29
30 public boolean getW(double km, double [] w) { 30 public boolean getW(double km, double [] w) {
31 return getW(km, w, 0);
32 }
33
34 public boolean getW(double km, double [] w, int index) {
31 35
32 if (kms.length == 0 || km < kms[0] || km > kms[kms.length-1]) { 36 if (kms.length == 0 || km < kms[0] || km > kms[kms.length-1]) {
33 w[0] = Double.NaN; 37 w[index] = Double.NaN;
34 return true; 38 return true;
35 } 39 }
36 40
37 int idx = Arrays.binarySearch(kms, km); 41 int idx = Arrays.binarySearch(kms, km);
38 42
39 if (idx >= 0) { 43 if (idx >= 0) {
40 w[0] = ws[idx]; 44 w[index] = ws[idx];
41 return true; 45 return true;
42 } 46 }
43 47
44 idx = -idx - 1; 48 idx = -idx - 1;
45 49
46 w[0] = Linear.linear(km, kms[idx], kms[idx+1], ws[idx], ws[idx+1]); 50 w[index] = Linear.linear(km, kms[idx], kms[idx+1], ws[idx], ws[idx+1]);
47 return false; 51 return false;
48 } 52 }
49 53
50 public double getQ(double km) { 54 public double getQ(double km) {
51 return qs.findQ(km); 55 return qs.findQ(km);

http://dive4elements.wald.intevation.org