Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/CalculationSelect.java @ 8292:86e532106abb
Set facet activity for middle bed height.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Wed, 17 Sep 2014 17:56:37 +0200 |
parents | e4606eae8ea5 |
children | 6c1ebf2220f5 0a5239a1e46e |
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:
4043
diff
changeset
|
9 package org.dive4elements.river.artifacts.states; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.Element; |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
15 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
16 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
17 import org.dive4elements.artifacts.CallMeta; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
19 import org.dive4elements.artifacts.common.utils.XMLUtils; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
21 import org.dive4elements.artifactdatabase.data.StateData; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
23 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
24 import org.dive4elements.river.artifacts.resources.Resources; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
25 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 */ |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public class CalculationSelect extends DefaultState { |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7110
diff
changeset
|
31 /** The log that is used in this class. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7110
diff
changeset
|
32 private static Logger log = Logger.getLogger(CalculationSelect.class); |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
4043
eb5564662e19
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4041
diff
changeset
|
34 /** Name of data item. */ |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
323
diff
changeset
|
35 public static final String FIELD_MODE = "calculation_mode"; |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
323
diff
changeset
|
36 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
37 /** Constant value for the reference line calculation. */ |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
38 public static final String CALCULATION_SURFACE_CURVE = |
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
39 "calc.surface.curve"; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
40 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
41 /** Constant value for the differences calculation. */ |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
42 public static final String CALCULATION_DURATION_CURVE = |
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
43 "calc.duration.curve"; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
44 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
45 /** Constant value for the flood map calculation. */ |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
46 public static final String CALCULATION_FLOOD_MAP = |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
47 "calc.flood.map"; |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
48 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
49 /** Constant value for the profile calculation. */ |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
50 public static final String CALCULATION_DISCHARGE_LONGITUDINAL_CURVE = |
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
51 "calc.discharge.longitudinal.section"; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
52 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
53 /** Constant value for the state discharge curve calculation. */ |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
54 public static final String CALCULATION_DISCHARGE_CURVE = |
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
55 "calc.discharge.curve"; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
56 |
1152
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
57 /** Constant value for the state w differences calculation. */ |
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
58 public static final String CALCULATION_W_DIFFERENCES = |
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
59 "calc.w.differences"; |
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
60 |
1960
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
61 /** Constant value for the state reference curve calculation. */ |
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
62 public static final String CALCULATION_REFERENCE_CURVE = |
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
63 "calc.reference.curve"; |
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
64 |
2118
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
65 /** Constant value for the historical discharge curve calculation. */ |
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
66 public static final String CALCULATION_HISTORICAL_DISCHARGE_CURVE = |
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
67 "calc.historical.discharge.curve"; |
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
68 |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
69 /** Constant value for the extreme W curve calculation. */ |
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
70 public static final String CALCULATION_EXTREME = |
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
71 "calc.extreme.curve"; |
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
72 |
1152
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
73 /** An array that holds all available calculation modes. */ |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
74 public static final String[] CALCULATIONS = { |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
75 CALCULATION_SURFACE_CURVE, |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
76 CALCULATION_FLOOD_MAP, |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
77 CALCULATION_DISCHARGE_CURVE, |
2118
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
78 CALCULATION_HISTORICAL_DISCHARGE_CURVE, |
157
b5c99532f898
Adapted the available calculation modes of WINFO and its order in the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
141
diff
changeset
|
79 CALCULATION_DURATION_CURVE, |
7110
5b20cf9926b7
Reactivate CALCULATION_DISCHARGE_LONGITUDINAL_CURVE
Andre Heinecke <aheinecke@intevation.de>
parents:
6513
diff
changeset
|
80 CALCULATION_DISCHARGE_LONGITUDINAL_CURVE, |
1960
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
81 CALCULATION_W_DIFFERENCES, |
6513
4447045ebcc6
Artifacts: DEACTIVATE SOME PATHS IN THE APP FOR THE 3.0.10 RELEASE. UNDO IT AFTERWARDS!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
82 CALCULATION_REFERENCE_CURVE //, |
4447045ebcc6
Artifacts: DEACTIVATE SOME PATHS IN THE APP FOR THE 3.0.10 RELEASE. UNDO IT AFTERWARDS!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
83 // CALCULATION_EXTREME |
4447045ebcc6
Artifacts: DEACTIVATE SOME PATHS IN THE APP FOR THE 3.0.10 RELEASE. UNDO IT AFTERWARDS!
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
84 }; |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
85 |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
86 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
87 /** Error message that is thrown if no mode has been chosen. */ |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
88 public static final String ERROR_NO_CALCULATION_MODE = |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
89 "error_feed_no_calculation_mode"; |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
90 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
91 /** Error message that is thrown if an invalid calculation mode has been |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
92 * chosen. */ |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
93 public static final String ERROR_INVALID_CALCULATION_MODE = |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
94 "error_feed_invalid_calculation_mode"; |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
95 |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
660
diff
changeset
|
96 |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
97 public CalculationSelect() { |
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
98 } |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
99 |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
100 |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
101 /** Create choices (i18ned). */ |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
102 @Override |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 protected Element[] createItems( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 XMLUtils.ElementCreator cr, |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
157
diff
changeset
|
105 Artifact artifact, |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 String name, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 CallContext context) |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 { |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
109 CallMeta meta = context.getMeta(); |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
110 Element[] calcs = new Element[CALCULATIONS.length]; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2118
diff
changeset
|
112 for (int i = 0; i < CALCULATIONS.length; ++i) { |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2118
diff
changeset
|
113 String calc = CALCULATIONS[i]; |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2118
diff
changeset
|
114 calcs[i] = createItem( |
141
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
115 cr, new String[] { |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
116 Resources.getMsg(meta, calc, calc), |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
117 calc |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
118 }); |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
119 } |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
120 |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
121 return calcs; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
125 /** Validate the chosen calculation. */ |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
126 @Override |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
127 public boolean validate(Artifact artifact) |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
128 throws IllegalArgumentException |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
129 { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7110
diff
changeset
|
130 log.debug("CalculationSelect.validate"); |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
131 D4EArtifact flys = (D4EArtifact) artifact; |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
132 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
323
diff
changeset
|
133 StateData data = getData(flys, FIELD_MODE); |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
134 String calc = (data != null) ? (String) data.getValue() : null; |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
135 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
136 if (calc == null) { |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
137 throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE); |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
138 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
139 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
140 calc = calc.trim().toLowerCase(); |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
141 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
142 for (String mode: CALCULATIONS) { |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
143 if (mode.equals(calc)) { |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
144 return true; |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
145 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
146 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
147 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
148 throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE); |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
149 } |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |