annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java @ 3996:c4400ccf158b

Add a default constructor for StaticState
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 01 Oct 2012 10:06:40 +0200
parents 6cdd994ee8a4
children 470a61d644cd
rev   line source
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
1968
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
3 import java.util.List;
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
4
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import de.intevation.flys.artifacts.model.FacetTypes;
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
1968
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
9 import de.intevation.artifactdatabase.state.Facet;
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
10 import de.intevation.artifactdatabase.state.DefaultOutput;
3935
6cdd994ee8a4 Make addOutput of StaticState public
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2004
diff changeset
11 import de.intevation.artifactdatabase.state.Output;
1968
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
12
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
13 import de.intevation.flys.artifacts.FLYSArtifact;
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
14
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
15 import de.intevation.artifacts.CallContext;
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
16 import de.intevation.artifacts.CallMeta;
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
17
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 /**
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 * Yet, a non-abstract DefaultState.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 */
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 public class StaticState
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 extends DefaultState
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 implements FacetTypes
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 {
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 /** The logger that is used in this state. */
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 private static final Logger logger = Logger.getLogger(StaticState.class);
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
27
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
28
3996
c4400ccf158b Add a default constructor for StaticState
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3935
diff changeset
29 public StaticState() {
c4400ccf158b Add a default constructor for StaticState
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3935
diff changeset
30 super();
c4400ccf158b Add a default constructor for StaticState
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3935
diff changeset
31 }
c4400ccf158b Add a default constructor for StaticState
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3935
diff changeset
32
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
33 /**
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
34 * Trivial constructor, sets id and description.
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
35 * @param id String used for both id and description.
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
36 */
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
37 public StaticState(String id) {
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
38 this(id, id);
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
39 }
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
40
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1112
diff changeset
41
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
42 public StaticState(String id, String description) {
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
43 super();
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
44 setID(id);
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
45 setDescription(description);
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1072
diff changeset
46 }
1968
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
47
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
48 public void addDefaultChartOutput(String nameDesc, List<Facet> facets) {
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
49 DefaultOutput output = new DefaultOutput(nameDesc,
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
50 nameDesc, "image/png", facets, "chart");
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
51 getOutputs().add(output);
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
52 }
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
53
2004
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
54 public static void addDefaultChartOutput(
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
55 DefaultState state,
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
56 String nameDesc,
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
57 List<Facet> facets
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
58 ) {
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
59 DefaultOutput output = new DefaultOutput(nameDesc,
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
60 nameDesc, "image/png", facets, "chart");
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
61 state.getOutputs().add(output);
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
62 }
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
63
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
64
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
65 /**
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
66 * Do nothing (override to include your logic).
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
67 * @param facets List of facets (to add to).
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
68 */
2004
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
69 public Object staticCompute(List<Facet> facets, FLYSArtifact artifact) {
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
70 return staticCompute(facets);
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
71 }
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
72
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
73 public Object staticCompute(List<Facet> facets) {
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
74 return null;
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
75 }
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
76
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
77
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
78 /** Call staticCompute to allow easy adjustments. */
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
79 @Override
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
80 public Object computeAdvance(
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
81 FLYSArtifact artifact,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
82 String hash,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
83 CallContext context,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
84 List<Facet> facets,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
85 Object old
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
86 ) {
2004
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
87 return staticCompute(facets, artifact);
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
88 }
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
89
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
90
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
91 /** Call staticCompute to allow easy adjustments. */
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
92 @Override
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
93 public Object computeFeed(
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
94 FLYSArtifact artifact,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
95 String hash,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
96 CallContext context,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
97 List<Facet> facets,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
98 Object old
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
99 ) {
2004
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
100 return staticCompute(facets, artifact);
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
101 }
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
102
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
103
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
104 /** Call staticCompute to allow easy adjustments. */
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
105 @Override
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
106 public Object computeInit(
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
107 FLYSArtifact artifact,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
108 String hash,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
109 Object context,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
110 CallMeta meta,
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
111 List<Facet> facets
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
112 ) {
2004
94c4dd5aaf20 Made StaticState a bit more convenient to use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1971
diff changeset
113 return staticCompute(facets, artifact);
1971
741d2067cfe1 Given CrossSections a name, let crosssection facets survive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1968
diff changeset
114 }
3935
6cdd994ee8a4 Make addOutput of StaticState public
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2004
diff changeset
115
6cdd994ee8a4 Make addOutput of StaticState public
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2004
diff changeset
116 public void addOutput(Output out) {
6cdd994ee8a4 Make addOutput of StaticState public
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2004
diff changeset
117 super.addOutput(out);
6cdd994ee8a4 Make addOutput of StaticState public
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2004
diff changeset
118 }
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 }
1968
18928f0f339b Add helper function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
120 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org