Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.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 | e727e3ebdf85 |
children |
comparison
equal
deleted
inserted
replaced
4441:093f9333f66b | 4442:26774405c884 |
---|---|
4 | 4 |
5 import de.intevation.artifacts.Artifact; | 5 import de.intevation.artifacts.Artifact; |
6 import de.intevation.artifacts.CallContext; | 6 import de.intevation.artifacts.CallContext; |
7 import de.intevation.flys.artifacts.FLYSArtifact; | 7 import de.intevation.flys.artifacts.FLYSArtifact; |
8 import de.intevation.flys.artifacts.model.CalculationResult; | 8 import de.intevation.flys.artifacts.model.CalculationResult; |
9 import de.intevation.flys.artifacts.model.DataFacet; | |
10 import de.intevation.flys.artifacts.model.FacetTypes; | 9 import de.intevation.flys.artifacts.model.FacetTypes; |
11 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | 10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
12 import de.intevation.flys.utils.KMIndex; | 11 import de.intevation.flys.utils.KMIndex; |
13 | 12 |
14 /** | 13 /** |
15 * Facet to show the outliers in a fix calculation. | 14 * Facet to show the outliers in a fix calculation. |
16 * | 15 * |
17 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 16 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
18 */ | 17 */ |
19 public class FixOutlierFacet | 18 public class FixOutlierFacet |
20 extends DataFacet | 19 extends FixingsFacet |
21 implements FacetTypes { | 20 implements FacetTypes { |
22 | 21 |
23 /** House logger. */ | 22 /** House logger. */ |
24 private static Logger logger = Logger.getLogger(FixOutlierFacet.class); | 23 private static Logger logger = Logger.getLogger(FixOutlierFacet.class); |
25 | 24 |
60 (CalculationResult) flys.compute(context, | 59 (CalculationResult) flys.compute(context, |
61 ComputeType.ADVANCE, | 60 ComputeType.ADVANCE, |
62 false); | 61 false); |
63 | 62 |
64 FixResult result = (FixResult) res.getData(); | 63 FixResult result = (FixResult) res.getData(); |
65 double currentKm = | 64 double currentKm = getCurrentKm(context); |
66 ((Double)context.getContextValue("currentKm")).doubleValue(); | |
67 | 65 |
68 KMIndex<QWI []> kmQWs = result.getOutliers(); | 66 KMIndex<QWI []> kmQWs = result.getOutliers(); |
69 KMIndex.Entry<QWI []> qwsEntry = kmQWs.binarySearch(currentKm); | 67 KMIndex.Entry<QWI []> qwsEntry = kmQWs.binarySearch(currentKm); |
70 | 68 |
71 QWI [] qws = null; | 69 QWI [] qws = null; |