Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQFacet.java @ 3436:0d63581c5df1
FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
flys-artifacts/trunk@5099 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 23 Jul 2012 08:38:23 +0000 |
parents | 0f7abd95c6e2 |
children | c105b4466b4e |
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; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 return interpolData.getWQAtKm(10); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 } |
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 * 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
|
51 * @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
|
52 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 return copy; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |