diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java @ 686:3dc61e00385e facets-slt

Merged with trunk and introduced hashing of computed values. flys-artifacts/branches/facets-slt@2126 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 15 Jun 2011 15:28:54 +0000
parents 60f24fca574a
children c09c9e05ecfa
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java	Wed Jun 08 13:03:21 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java	Wed Jun 15 15:28:54 2011 +0000
@@ -15,6 +15,8 @@
 
 import org.apache.log4j.Logger;
 
+import de.intevation.flys.artifacts.model.Calculation;
+
 public class BackJumpCorrector
 implements   Serializable
 {
@@ -40,8 +42,11 @@
         return corrected;
     }
 
-    public boolean doCorrection(double [] km, double [] ws) {
-
+    public boolean doCorrection(
+        double []   km,
+        double []   ws,
+        Calculation errors
+    ) {
         boolean wsUp = isIncreasing(ws);
 
         if (wsUp) {
@@ -62,7 +67,7 @@
             log.debug("BackJumpCorrector.doCorrection ------- leave");
         }
 
-        boolean hasBackJumps = doCorrectionClean(km, ws);
+        boolean hasBackJumps = doCorrectionClean(km, ws, errors);
 
         if (hasBackJumps && wsUp) {
             // mirror back
@@ -72,7 +77,11 @@
         return hasBackJumps;
     }
 
-    protected boolean doCorrectionClean(double [] km, double [] ws) {
+    protected boolean doCorrectionClean(
+        double []   km,
+        double []   ws,
+        Calculation errors
+    ) {
         int N = km.length;
 
         if (N != ws.length) {
@@ -201,6 +210,8 @@
                 spline = interpolator.interpolate(x, y);
             }
             catch (MathIllegalArgumentException miae) {
+                // TODO: I18N
+                errors.addProblem("creating spline interpolation failed.");
                 log.error(miae);
                 continue;
             }
@@ -226,6 +237,8 @@
                 }
             }
             catch (ArgumentOutsideDomainException aode) {
+                // TODO: I18N
+                errors.addProblem("spline interpolation failed.");
                 log.error("spline interpolation failed", aode);
             }
         } // for all km

http://dive4elements.wald.intevation.org