Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java @ 2407:dce0cc856357
'Bezugslinien': Added axis labels matching the displayed data.
flys-artifacts/trunk@4036 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 10 Feb 2012 16:00:57 +0000 |
parents | f008c3335a77 |
children | ccc955ef8811 |
rev | line source |
---|---|
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.Artifact; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
2125
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
9 import de.intevation.artifactdatabase.state.Facet; |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.DefaultFacet; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 /** |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 * Facet that writes artifact-uui and facet index on the blackboard, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 * delivers data if asked so. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 public class BlackboardDataFacet extends DefaultFacet { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 public BlackboardDataFacet() {} |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 /** Do not instantiate a BlackboardDataFacet, subclass it instead. */ |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 public BlackboardDataFacet(int idx, String name, String description) { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 super(idx, name, description); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
2122
81312f84689a
Refactored to easier enjoy benefits of caching.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2104
diff
changeset
|
26 /** Do not instantiate a BlackboardDataFacet, subclass it instead. */ |
81312f84689a
Refactored to easier enjoy benefits of caching.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2104
diff
changeset
|
27 public BlackboardDataFacet(String name, String description) { |
81312f84689a
Refactored to easier enjoy benefits of caching.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2104
diff
changeset
|
28 super(0, name, description); |
81312f84689a
Refactored to easier enjoy benefits of caching.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2104
diff
changeset
|
29 } |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
2104
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
31 /** Define key to which to respond when asked for 'blackboard' |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
32 * (DataProvider)- data. */ |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
33 public String areaDataKey(Artifact art) { |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
34 return art.identifier() + ":" + getName() + ":" + getIndex(); |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
35 } |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
36 |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
37 |
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
38 /** Hey, We can ArtifactUUID+:+FacetName+:+FacetIndex (i.e. getData)! */ |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2125
diff
changeset
|
39 @Override |
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2125
diff
changeset
|
40 public List getStaticDataProviderKeys(Artifact art) { |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 List list = new ArrayList(); |
2104
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
42 list.add(areaDataKey(art)); |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 return list; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 /** |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * Can provide whatever getData returns. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 * @param key will respond on uuid+index |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 * @param param ignored |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * @param context ignored |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * @return whatever getData delivers. |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 */ |
2405
f008c3335a77
Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2125
diff
changeset
|
54 @Override |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 public Object provideBlackboardData(Artifact artifact, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 Object key, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 Object param, |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 CallContext context |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 ) { |
2104
bb0dede9294f
Implementation towards areas at other than first axis (flys/issue441).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2024
diff
changeset
|
60 if (key.equals(areaDataKey(artifact))) { |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 return getData(artifact, context); |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 else { |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 return null; |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 } |
2125
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
67 |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
68 /** Copy deeply. */ |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
69 @Override |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
70 public Facet deepCopy() { |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
71 BlackboardDataFacet copy = new BlackboardDataFacet(); |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
72 copy.set(this); |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
73 return copy; |
7a8f52267a5c
Fix stateId/hash assignment in WaterlevelFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2122
diff
changeset
|
74 } |
2024
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 } |
2bb160b2768e
New facet, will ease converting other facets to be able to contribute to area computations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |