Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation2.java @ 709:3b7e9ddf6bb1
New model to transport data and error reports of calculations.
flys-artifacts/trunk@2165 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 20 Jun 2011 12:32:32 +0000 |
parents | a95f34f1f39a |
children | 2898b1ff6013 |
comparison
equal
deleted
inserted
replaced
708:757ff56b43b3 | 709:3b7e9ddf6bb1 |
---|---|
16 | 16 |
17 public Calculation2(double km) { | 17 public Calculation2(double km) { |
18 this.km = km; | 18 this.km = km; |
19 } | 19 } |
20 | 20 |
21 public WQKms calculate(WstValueTable wst) { | 21 public CalculationResult calculate(WstValueTable wst) { |
22 | 22 |
23 logger.debug("Calculation2.calculate"); | 23 logger.debug("Calculation2.calculate"); |
24 | 24 |
25 double [][] wqs = wst.interpolateWQ(km, this); | 25 double [][] wqs = wst.interpolateWQ(km, this); |
26 | 26 |
27 if (wqs == null || wqs[0].length == 0) { | 27 if (wqs == null || wqs[0].length == 0) { |
28 logger.debug("Cannot compute discharge curve data."); | 28 logger.debug("Cannot compute discharge curve data."); |
29 return null; | 29 addProblem("Cannot compute discharge curve data."); |
30 return new CalculationResult(new WQKms[0], this); | |
30 } | 31 } |
31 | 32 |
32 double [] ws = wqs[0]; | 33 double [] ws = wqs[0]; |
33 double [] qs = wqs[1]; | 34 double [] qs = wqs[1]; |
34 double [] kms = new double[ws.length]; | 35 double [] kms = new double[ws.length]; |
40 if (hasProblems()) { | 41 if (hasProblems()) { |
41 logger.debug("found + "+numProblems()+" problems."); | 42 logger.debug("found + "+numProblems()+" problems."); |
42 wqkms.removeNaNs(); | 43 wqkms.removeNaNs(); |
43 } | 44 } |
44 | 45 |
45 return wqkms; | 46 return new CalculationResult(new WQKms[] { wqkms }, this); |
46 } | 47 } |
47 } | 48 } |
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 49 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |