diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java @ 674:d5f9ba1d055f

Added calculation base class to collect the problems during the calculations. Adjusted calculation 4 to use the mechanism. flys-artifacts/trunk@2098 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 10 Jun 2011 09:19:27 +0000
parents e0e39a0eb3fe
children eab5e5089d77
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java	Thu Jun 09 10:48:13 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java	Fri Jun 10 09:19:27 2011 +0000
@@ -20,6 +20,7 @@
 import org.apache.log4j.Logger;
 
 public class Calculation4
+extends      Calculation
 {
     private static Logger logger = Logger.getLogger(Calculation4.class);
 
@@ -100,6 +101,8 @@
 
         if (segments.isEmpty()) {
             logger.debug("no segments found");
+            // TODO: I18N
+            addProblem("no segments found");
             return new WQKms[0];
         }
 
@@ -107,6 +110,8 @@
 
         if (numResults < 1) {
             logger.debug("no values given");
+            // TODO: I18N
+            addProblem("no values given");
             return new WQKms[0];
         }
 
@@ -213,7 +218,8 @@
                             anchor.values[i]);
 
                         if ((qPositions[i] = qi) == null) {
-                            // TODO: error report
+                            // TODO: I18N
+                            addProblem(pos, "cannot find q = " + anchor.values[i]);
                             functions[i] = Identity.IDENTITY;
                         }
                         else {
@@ -249,7 +255,8 @@
                     results[i].add(out[0], out[1], pos);
                 }
                 else {
-                    // TODO: error report
+                    // TODO: I18N
+                    addProblem(pos, "cannot interpolate w/q");
                 }
             }
         }
@@ -261,10 +268,9 @@
             double [] ws  = results[i].getWs();
             double [] kms = results[i].getKms();
 
-            if (bjc.doCorrection(kms, ws)) {
+            if (bjc.doCorrection(kms, ws, this)) {
                 results[i] = new WQCKms(results[i], bjc.getCorrected());
             }
-            // TODO: error report
         }
 
         // name the curves
@@ -276,7 +282,7 @@
     }
 
     protected String createName(int index) {
-        // TODO: i18n
+        // TODO: I18N
         StringBuilder sb = new StringBuilder(isQ ? "Q" : "W");
         sb.append(" benutzerdefiniert (");
         for (int i = 0, N = segments.size(); i < N; ++i) {

http://dive4elements.wald.intevation.org