Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.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 | 60f24fca574a |
children | c09c9e05ecfa |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java Thu Jun 09 10:48:13 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java Fri Jun 10 09:19:27 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