Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java @ 3083:4bd3d8bbb60c
Added missing vim lines.
flys-artifacts/trunk@4679 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 18 Jun 2012 08:33:48 +0000 |
parents | dc2765e31e1f |
children | 960307cf2adc |
rev | line source |
---|---|
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:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.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:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.utils.KMIndex; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.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:
diff
changeset
|
11 import de.intevation.flys.artifacts.FixationArtifactAccess; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.model.FacetTypes; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.model.DataFacet; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.CalculationResult; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 * Facet to show W values for Q values at km for a date. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 * |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 public class FixReferenceEventsFacet |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 extends DataFacet |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 implements FacetTypes { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 /** House logger. */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 private static Logger logger = Logger.getLogger(FixReferenceEventsFacet.class); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
3080
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
32 private double currentKm; |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
33 |
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:
diff
changeset
|
34 /** Trivial Constructor. */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 public FixReferenceEventsFacet() { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 * @param name |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 */ |
3043
22da13d1b180
Added facet for derivate curve and fixed facet names.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3039
diff
changeset
|
42 public FixReferenceEventsFacet(int index, String name, String description) { |
3039
7db919b1bc1e
Added new facet for analysis periods and updated facet names in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
43 super(index, |
3043
22da13d1b180
Added facet for derivate curve and fixed facet names.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3039
diff
changeset
|
44 name, |
3039
7db919b1bc1e
Added new facet for analysis periods and updated facet names in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
45 description, |
7db919b1bc1e
Added new facet for analysis periods and updated facet names in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
46 ComputeType.ADVANCE, |
7db919b1bc1e
Added new facet for analysis periods and updated facet names in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
47 null, |
7db919b1bc1e
Added new facet for analysis periods and updated facet names in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3035
diff
changeset
|
48 null); |
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:
diff
changeset
|
49 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
3080
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
52 public Object getData(Artifact artifact, CallContext context, double km) { |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
53 this.currentKm = km; |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
54 return getData(artifact, context); |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
55 } |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
56 |
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
57 |
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:
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:
diff
changeset
|
59 * Returns the data this facet requires. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 * |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 * @param artifact the owner 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:
diff
changeset
|
62 * @param context the CallContext (ignored). |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 * |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 * @return the data. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 @Override |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 public Object getData(Artifact artifact, CallContext 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:
diff
changeset
|
68 logger.debug("FixReferenceEventsFacet.getData"); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 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:
diff
changeset
|
71 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:
diff
changeset
|
72 FixationArtifactAccess access = new FixationArtifactAccess(flys); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 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:
diff
changeset
|
75 (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:
diff
changeset
|
76 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:
diff
changeset
|
77 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:
diff
changeset
|
78 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 FixResult result = (FixResult) res.getData(); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 KMIndex<QW []> kmQWs = result.getReferenced(); |
3080
dc2765e31e1f
Added getData method with an additional km parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3062
diff
changeset
|
82 KMIndex.Entry<QW []> kmQWsEntry = kmQWs.binarySearch(currentKm); |
3062
7660cfe5e8f6
FixWQCurveGenerator can generate charts from Fix*-Facets (in theory and not complete)
Christian Lins <christian.lins@intevation.de>
parents:
3043
diff
changeset
|
83 QW[] qws = null; |
7660cfe5e8f6
FixWQCurveGenerator can generate charts from Fix*-Facets (in theory and not complete)
Christian Lins <christian.lins@intevation.de>
parents:
3043
diff
changeset
|
84 if (kmQWsEntry != null) { |
7660cfe5e8f6
FixWQCurveGenerator can generate charts from Fix*-Facets (in theory and not complete)
Christian Lins <christian.lins@intevation.de>
parents:
3043
diff
changeset
|
85 qws = kmQWsEntry.getValue(); |
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:
diff
changeset
|
86 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 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:
diff
changeset
|
88 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 else { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 logger.debug("Not an instance of FixationArtifact."); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 return null; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 /** |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 * Create a deep copy of this Facet. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 * @return a deep copy. |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 */ |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 @Override |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 public FixReferenceEventsFacet deepCopy() { |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 FixReferenceEventsFacet copy = new FixReferenceEventsFacet(); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 copy.set(this); |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 return copy; |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 } |
b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |