Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | e727e3ebdf85 |
children | 26774405c884 |
rev | line source |
---|---|
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
3 import org.apache.log4j.Logger; |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
4 |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.FLYSArtifact; |
3203
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3192
diff
changeset
|
8 import de.intevation.flys.artifacts.model.CalculationResult; |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3192
diff
changeset
|
9 import de.intevation.flys.artifacts.model.DataFacet; |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.model.FacetTypes; |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
3203
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3192
diff
changeset
|
12 import de.intevation.flys.utils.KMIndex; |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3192
diff
changeset
|
13 |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 /** |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 * Facet to show the outliers in a fix calculation. |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 * |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 */ |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 public class FixOutlierFacet |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 extends DataFacet |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 implements FacetTypes { |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 /** House logger. */ |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 private static Logger logger = Logger.getLogger(FixOutlierFacet.class); |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 /** Trivial Constructor. */ |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 public FixOutlierFacet() { |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 } |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 /** |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 * @param name |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 */ |
3043
22da13d1b180
Added facet for derivate curve and fixed facet names.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
34 public FixOutlierFacet(String name, String description) { |
22da13d1b180
Added facet for derivate curve and fixed facet names.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
35 super(0, name, description, ComputeType.ADVANCE, null, null); |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 } |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
3192
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3088
diff
changeset
|
38 public FixOutlierFacet(int index, String name, String description) { |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3088
diff
changeset
|
39 super(index, name, description, ComputeType.ADVANCE, null, null); |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3088
diff
changeset
|
40 } |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3088
diff
changeset
|
41 |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 /** |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 * Returns the data this facet requires. |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 * |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
46 * @param artifact the owner artifact; needs to be a FLYSArtifact. |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
47 * @param context the CallContext; required to retrieve the value of |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
48 * <i>currentKm</i>. |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 * |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
50 * @return an array of QW objects or null. |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 */ |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 @Override |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 public Object getData(Artifact artifact, CallContext context) { |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 logger.debug("FixOutlierFacet.getData"); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
55 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
56 if (artifact instanceof FLYSArtifact) { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
57 FLYSArtifact flys = (FLYSArtifact)artifact; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
58 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
59 CalculationResult res = |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
60 (CalculationResult) flys.compute(context, |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
61 ComputeType.ADVANCE, |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
62 false); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
63 |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
64 FixResult result = (FixResult) res.getData(); |
3088
960307cf2adc
Moved current km to context and added an abstract generator for fix analysis
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3080
diff
changeset
|
65 double currentKm = |
960307cf2adc
Moved current km to context and added an abstract generator for fix analysis
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3080
diff
changeset
|
66 ((Double)context.getContextValue("currentKm")).doubleValue(); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
67 |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
68 KMIndex<QWI []> kmQWs = result.getOutliers(); |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
69 KMIndex.Entry<QWI []> qwsEntry = kmQWs.binarySearch(currentKm); |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
70 |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
71 QWI [] qws = null; |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
72 if (qwsEntry != null) { |
3062
7660cfe5e8f6
FixWQCurveGenerator can generate charts from Fix*-Facets (in theory and not complete)
Christian Lins <christian.lins@intevation.de>
parents:
3043
diff
changeset
|
73 qws = qwsEntry.getValue(); |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
74 |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
75 if (logger.isDebugEnabled()) { |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
76 logger.debug("Found " + (qws != null ? qws.length : 0) |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
77 + " KMIndex.Entry for km " + currentKm); |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
78 } |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
79 } |
3466
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
80 else { |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
81 logger.debug("Found no KMIndex.Entry for km " + currentKm); |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
82 } |
8160e62bbb3a
Registered new output 'fix_vollmer_wq_curve' for the vollmer path of fixings analysis module; create required Facets for it after calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3415
diff
changeset
|
83 |
3035
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
84 return qws; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3028
diff
changeset
|
85 } |
3729
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
86 |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
87 logger.warn("Not an instance of FLYSArtifact."); |
e727e3ebdf85
Factored out a pure QW model to be more reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3466
diff
changeset
|
88 return null; |
3028
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 } |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 /** |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 * Create a deep copy of this Facet. |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 * @return a deep copy. |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 */ |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 @Override |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 public FixOutlierFacet deepCopy() { |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 FixOutlierFacet copy = new FixOutlierFacet(); |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 copy.set(this); |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 return copy; |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 } |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 } |
77b5f5a26700
Added facets for fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |