Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java @ 3728:d03e65378b9f
Removed obsolete code. Removed NPE as regular flow control.
flys-artifacts/trunk@5401 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 08 Sep 2012 13:36:06 +0000 |
parents | c105b4466b4e |
children | 5a28312aee99 |
rev | line source |
---|---|
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.Artifact; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.CallContext; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifactdatabase.state.DefaultFacet; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.WQKmsInterpolArtifact; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 * Facet to show W|Q Values. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 public class WQFacet |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 extends DefaultFacet |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 implements FacetTypes { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 /** Trivial Constructor. */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 public WQFacet(String description) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 this(STATIC_WQ, description); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 * A Facet with WQ data. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public WQFacet(String name, String description) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 this.name = name; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 this.description = description; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 this.index = 0; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 * Returns the data this facet requires. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * @param artifact the owner artifact. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * @param context the CallContext (ignored). |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * @return the data. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 public Object getData(Artifact artifact, CallContext context) { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 WQKmsInterpolArtifact interpolData = |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 (WQKmsInterpolArtifact) artifact; |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
45 Double currentKm = (Double)context.getContextValue("currentKm"); |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
46 return interpolData.getWQAtKm(currentKm); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * Create a deep copy of this Facet. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * @return a deep copy. |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 public WQKmsFacet deepCopy() { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 WQKmsFacet copy = new WQKmsFacet(description); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 copy.set(this); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 return copy; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |