diff 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
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation1.java	Sat Jun 18 18:38:04 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation1.java	Sat Jun 18 20:20:34 2011 +0000
@@ -13,6 +13,7 @@
     protected double [] qs;
     protected double [] ws;
     protected boolean   up;
+    protected double    refKm;
 
     public Calculation1() {
     }
@@ -21,19 +22,23 @@
         double [] kms, 
         double [] qs, 
         double [] ws,
+        double    refKm,
         boolean   up
     ) {
-        this.kms = kms;
-        this.qs  = qs;
-        this.ws  = ws;
-        this.up  = up;
+        this.kms   = kms;
+        this.qs    = qs;
+        this.ws    = ws;
+        this.refKm = refKm;
+        this.up    = up;
     }
 
     public WQKms [] calculate(WstValueTable wst) {
 
         ArrayList<WQKms> results = new ArrayList<WQKms>();
 
-        double ref = kms[up ? 0 : kms.length-1];
+        double ref = Double.isNaN(refKm)
+            ? kms[up ? 0 : kms.length-1]
+            : refKm;
 
         String    prefix;
         double [] origData;

http://dive4elements.wald.intevation.org