annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java @ 7653:e609722a1e86

issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 05 Dec 2013 17:38:10 +0100
parents c7638c971574
children 5484818087de
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
9 package org.dive4elements.river.artifacts.states;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.List;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
13 import gnu.trove.TDoubleArrayList;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
14
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
17 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
20 import org.dive4elements.artifactdatabase.state.Facet;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
22 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
23 import org.dive4elements.river.artifacts.StaticWQKmsArtifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
24
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
25 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet;
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
26 import org.dive4elements.river.artifacts.model.DataFacet;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
27 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
28 import org.dive4elements.river.artifacts.model.RelativePointFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
29 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
30 import org.dive4elements.river.artifacts.model.WQKmsFacet;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 * Only state of WQKmsArtifact.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 public class StaticWQKmsState
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 extends DefaultState
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 implements FacetTypes
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 /** The logger that is used in this state. */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 private static Logger logger = Logger.getLogger(StaticWQKmsState.class);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 * From this state can not be continued.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 protected String getUIProvider() {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 return "noinput";
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 * Compute, create Facets, do the same stuff as all the other states do.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 protected Object compute(
7584
c7638c971574 Renamed winfo variable to more fitting name artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7254
diff changeset
56 StaticWQKmsArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 CallMeta metaLocale,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 List<Facet> facets,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 Object old
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 ) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 String id = getID();
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
63 String code = artifact.getDataAsString("ids");
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
64 String [] parts = code.split("-");
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
66 // Return from cache, if present.
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 WQKms res = old instanceof WQKms
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 ? (WQKms)old
7584
c7638c971574 Renamed winfo variable to more fitting name artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7254
diff changeset
69 : artifact.getWQKms();
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 WQKms wqkms = res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 if (facets == null) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 return res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
77 String wkmsName = wqkms.getName();
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
78
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
79 Facet wqfacet = new WQKmsFacet(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
80 STATIC_WQ,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
81 wkmsName);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
82 facets.add(wqfacet);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
83
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
84 if (parts[0].equals("officials_wq")) {
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
85 // Early stop. We only want wq-points in that case.
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
86 return res;
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
87 }
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
88
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 /*
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 * TODO: re-enable HEIGHTMARKS_POINTS-thing
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 String name;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 if (parts[0].equals(HEIGHTMARKS_POINTS)) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 name = HEIGHTMARKS_POINTS;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 else {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 name = STATIC_WQKMS;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 */
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
100 // Spawn Q Facet only if at least one discharge value
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
101 // is != -1
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
102 boolean qEmpty = true;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
103 TDoubleArrayList qs = wqkms.allQs();
7254
fe32a7f9655e Reduce usage of careless 'for (int i = 0; i < x.size(); i++)' pattern.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7066
diff changeset
104 for (int i = 0, Q = qs.size(); i < Q; i++) {
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
105 if (qs.getQuick(i) != -1d) {
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
106 qEmpty = false;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
107 break;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
108 }
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
109 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
111 // issue1494: Only spawn qfacet if discharges are given
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
112 if (!qEmpty) {
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
113 Facet qfacet = new WQKmsFacet(
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
114 STATIC_WQKMS_Q,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
115 wkmsName
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
116 // TODO re-enable translations.
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
117 /*
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
118 Resources.getMsg(
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
119 metaLocale,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
120 wkmsName,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
121 wkmsName)*/);
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
122 facets.add(qfacet);
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
123 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124
5799
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
125 Facet rpFacet = new RelativePointFacet(wkmsName);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
126 facets.add(rpFacet);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
127
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
128 Facet csFacet = new CrossSectionWaterLineFacet(0,
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
129 wkmsName);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
130 facets.add(csFacet);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
131
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
132 wkmsName = "W (" + wkmsName + ")";
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
133
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 Facet wfacet = new WQKmsFacet(
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 STATIC_WQKMS_W,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 wkmsName
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 /*
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 // TODO re-enable translations.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 Resources.getMsg(
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 metaLocale,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 wkmsName,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 wkmsName)*/);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 facets.add(wfacet);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
145 Facet wstfacet = new DataFacet(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
146 WST,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
147 wkmsName,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
148 ComputeType.ADVANCE, hash, id);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
149 facets.add(wstfacet);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
150
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 return res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
154 @Override
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
155 public Object computeAdvance(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
156 D4EArtifact artifact,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
157 String hash,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
158 CallContext context,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
159 List<Facet> facets,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
160 Object old
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
161 ) {
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
162 return compute((StaticWQKmsArtifact) artifact, context.getMeta(),
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
163 hash, facets, old);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
164 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 * Get data, create the facets.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 *
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 * @param context Ignored.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 public Object computeFeed(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
173 D4EArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 CallContext context,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 List<Facet> facets,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 Object old
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 ) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 return compute((StaticWQKmsArtifact) artifact, context.getMeta(),
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 hash, facets, old);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 * Create the facets.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 * @param context Ignored.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 public Object computeInit(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
190 D4EArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 Object context,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 CallMeta meta,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 List<Facet> facets
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 ) {
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
196 return compute((StaticWQKmsArtifact) artifact, meta,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
197 hash, facets, null);
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org