comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation1.java @ 708:757ff56b43b3

Added calculation "am Pegel" version to the "Wasserspiegellage" calculation. flys-artifacts/trunk@2161 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 18 Jun 2011 20:20:34 +0000
parents 19a3185822a4
children 3b7e9ddf6bb1
comparison
equal deleted inserted replaced
707:b6f57d927905 708:757ff56b43b3
11 11
12 protected double [] kms; 12 protected double [] kms;
13 protected double [] qs; 13 protected double [] qs;
14 protected double [] ws; 14 protected double [] ws;
15 protected boolean up; 15 protected boolean up;
16 protected double refKm;
16 17
17 public Calculation1() { 18 public Calculation1() {
18 } 19 }
19 20
20 public Calculation1( 21 public Calculation1(
21 double [] kms, 22 double [] kms,
22 double [] qs, 23 double [] qs,
23 double [] ws, 24 double [] ws,
25 double refKm,
24 boolean up 26 boolean up
25 ) { 27 ) {
26 this.kms = kms; 28 this.kms = kms;
27 this.qs = qs; 29 this.qs = qs;
28 this.ws = ws; 30 this.ws = ws;
29 this.up = up; 31 this.refKm = refKm;
32 this.up = up;
30 } 33 }
31 34
32 public WQKms [] calculate(WstValueTable wst) { 35 public WQKms [] calculate(WstValueTable wst) {
33 36
34 ArrayList<WQKms> results = new ArrayList<WQKms>(); 37 ArrayList<WQKms> results = new ArrayList<WQKms>();
35 38
36 double ref = kms[up ? 0 : kms.length-1]; 39 double ref = Double.isNaN(refKm)
40 ? kms[up ? 0 : kms.length-1]
41 : refKm;
37 42
38 String prefix; 43 String prefix;
39 double [] origData; 44 double [] origData;
40 45
41 if (ws != null) { prefix = "W="; origData = ws; } 46 if (ws != null) { prefix = "W="; origData = ws; }

http://dive4elements.wald.intevation.org