Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.java @ 4442:26774405c884
Introduce a new FixingsFacet to add save access to the current Km
Values which are accessed by a String like a map must be checked for null. The
new FixingsFacet adds a getCurrentKm method that abstracts the direct access to
the CallContext and always returns a valid double value.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 07 Nov 2012 14:06:03 +0100 |
parents | e3c7a3228bc2 |
children | acfd48384835 |
comparison
equal
deleted
inserted
replaced
4441:093f9333f66b | 4442:26774405c884 |
---|---|
5 | 5 |
6 import de.intevation.flys.artifacts.FLYSArtifact; | 6 import de.intevation.flys.artifacts.FLYSArtifact; |
7 import de.intevation.flys.artifacts.access.FixAnalysisAccess; | 7 import de.intevation.flys.artifacts.access.FixAnalysisAccess; |
8 | 8 |
9 import de.intevation.flys.artifacts.model.CalculationResult; | 9 import de.intevation.flys.artifacts.model.CalculationResult; |
10 import de.intevation.flys.artifacts.model.DataFacet; | |
11 import de.intevation.flys.artifacts.model.FacetTypes; | 10 import de.intevation.flys.artifacts.model.FacetTypes; |
12 import de.intevation.flys.artifacts.model.Parameters; | 11 import de.intevation.flys.artifacts.model.Parameters; |
13 | 12 |
14 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | 13 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
15 | 14 |
20 * Facet to show the W|Q values. | 19 * Facet to show the W|Q values. |
21 * | 20 * |
22 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
23 */ | 22 */ |
24 public class FixDeviationFacet | 23 public class FixDeviationFacet |
25 extends DataFacet | 24 extends FixingsFacet |
26 implements FacetTypes { | 25 implements FacetTypes { |
27 | 26 |
28 /** House logger. */ | 27 /** House logger. */ |
29 private static Logger logger = Logger.getLogger(FixDeviationFacet.class); | 28 private static Logger logger = Logger.getLogger(FixDeviationFacet.class); |
30 | 29 |
66 (CalculationResult) flys.compute(context, | 65 (CalculationResult) flys.compute(context, |
67 ComputeType.ADVANCE, | 66 ComputeType.ADVANCE, |
68 false); | 67 false); |
69 | 68 |
70 FixAnalysisResult result = (FixAnalysisResult) res.getData(); | 69 FixAnalysisResult result = (FixAnalysisResult) res.getData(); |
71 double currentKm = | 70 double currentKm = getCurrentKm(context); |
72 ((Double)context.getContextValue("currentKm")).doubleValue(); | |
73 | 71 |
74 Parameters params = result.getParameters(); | 72 Parameters params = result.getParameters(); |
75 | 73 |
76 double[] stdDev = | 74 double[] stdDev = |
77 params.interpolate("km", currentKm, STD_DEV_COLUMN); | 75 params.interpolate("km", currentKm, STD_DEV_COLUMN); |