Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/BackJumpCorrector.java @ 649:44175d4720f8
Fix crashes in back jump correction.
flys-artifacts/trunk@2038 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 01 Jun 2011 09:57:22 +0000 |
parents | 2dbbb5be30a1 |
children | 60f24fca574a |
comparison
equal
deleted
inserted
replaced
648:d4c4fefb095b | 649:44175d4720f8 |
---|---|
8 import org.apache.commons.math.analysis.interpolation.SplineInterpolator; | 8 import org.apache.commons.math.analysis.interpolation.SplineInterpolator; |
9 | 9 |
10 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; | 10 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; |
11 | 11 |
12 import org.apache.commons.math.ArgumentOutsideDomainException; | 12 import org.apache.commons.math.ArgumentOutsideDomainException; |
13 | |
14 import org.apache.commons.math.exception.MathIllegalArgumentException; | |
13 | 15 |
14 import org.apache.log4j.Logger; | 16 import org.apache.log4j.Logger; |
15 | 17 |
16 public class BackJumpCorrector | 18 public class BackJumpCorrector |
17 implements Serializable | 19 implements Serializable |
123 ikm = km[back]; | 125 ikm = km[back]; |
124 } | 126 } |
125 break; | 127 break; |
126 } | 128 } |
127 | 129 |
128 if (back < 0) { | 130 if (back <= 0) { |
129 //log.debug("run over left border"); | 131 //log.debug("run over left border"); |
130 // fill with same as ws[i] | 132 // fill with same as ws[i] |
131 for (int j = 0; j < i; ++j) { | 133 for (int j = 0; j < i; ++j) { |
132 ws[j] = ws[i]; | 134 ws[j] = ws[i]; |
133 } | 135 } |
191 for (int j = 0; j < x.length; ++j) { | 193 for (int j = 0; j < x.length; ++j) { |
192 log.debug(" " + x[j] + " -> " + y[j]); | 194 log.debug(" " + x[j] + " -> " + y[j]); |
193 } | 195 } |
194 } | 196 } |
195 | 197 |
196 PolynomialSplineFunction spline = interpolator.interpolate(x, y); | 198 PolynomialSplineFunction spline; |
199 | |
200 try { | |
201 spline = interpolator.interpolate(x, y); | |
202 } | |
203 catch (MathIllegalArgumentException miae) { | |
204 log.error(miae); | |
205 continue; | |
206 } | |
197 | 207 |
198 try { | 208 try { |
199 if (log.isDebugEnabled()) { | 209 if (log.isDebugEnabled()) { |
200 log.debug("spline points:"); | 210 log.debug("spline points:"); |
201 for (int j = 0; j < x.length; ++j) { | 211 for (int j = 0; j < x.length; ++j) { |