Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/CalculationSelect.java @ 9638:6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Thu, 31 Oct 2019 17:37:53 +0100 |
parents | e4606eae8ea5 |
children |
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; |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
12 import org.dive4elements.artifactdatabase.data.StateData; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
13 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
14 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
15 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
16 import org.dive4elements.artifacts.common.utils.XMLUtils; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
17 import org.dive4elements.river.artifacts.D4EArtifact; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4043
diff
changeset
|
18 import org.dive4elements.river.artifacts.resources.Resources; |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
19 import org.w3c.dom.Element; |
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
|
20 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @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
|
23 */ |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class CalculationSelect extends DefaultState { |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7110
diff
changeset
|
26 /** 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
|
27 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
|
28 |
4043
eb5564662e19
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4041
diff
changeset
|
29 /** 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
|
30 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
|
31 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
32 /** Constant value for the reference line calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
33 public static final String CALCULATION_SURFACE_CURVE = "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
|
34 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
35 /** Constant value for the differences calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
36 public static final String CALCULATION_DURATION_CURVE = "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
|
37 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
38 /** Constant value for the flood map calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
39 public static final String CALCULATION_FLOOD_MAP = "calc.flood.map"; |
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 profile calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
42 public static final String CALCULATION_DISCHARGE_LONGITUDINAL_CURVE = "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
|
43 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
44 /** Constant value for the state discharge curve calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
45 public static final String CALCULATION_DISCHARGE_CURVE = "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
|
46 |
1152
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
47 /** Constant value for the state w differences calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
48 public static final String CALCULATION_W_DIFFERENCES = "calc.w.differences"; |
1152
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
49 |
1960
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
50 /** Constant value for the state reference curve calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
51 public static final String CALCULATION_REFERENCE_CURVE = "calc.reference.curve"; |
1960
be06dbc2ed1d
Added 'Bezugslinie' to choice of calculation modes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1187
diff
changeset
|
52 |
2118
4d57d456e261
Added a new calculation option for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1960
diff
changeset
|
53 /** Constant value for the historical discharge curve calculation. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
54 public static final String CALCULATION_HISTORICAL_DISCHARGE_CURVE = "calc.historical.discharge.curve"; |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
55 |
1152
fc572b30f1b8
Added configuration to kick-in w-differences branch of winfo.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
56 /** An array that holds all available calculation modes. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
57 public static final String[] CALCULATIONS = { CALCULATION_SURFACE_CURVE, CALCULATION_FLOOD_MAP, CALCULATION_DISCHARGE_CURVE, |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
58 CALCULATION_HISTORICAL_DISCHARGE_CURVE, CALCULATION_DURATION_CURVE, CALCULATION_DISCHARGE_LONGITUDINAL_CURVE, CALCULATION_W_DIFFERENCES, |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
59 CALCULATION_REFERENCE_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
|
60 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1050
diff
changeset
|
61 /** Error message that is thrown if no mode has been chosen. */ |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
62 public static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode"; |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
63 |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
64 /** |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
65 * Error message that is thrown if an invalid calculation mode has been |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
66 * chosen. |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
67 */ |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
68 public static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode"; |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
660
diff
changeset
|
69 |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
70 public CalculationSelect() { |
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
71 } |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
72 |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
73 /** Create choices (i18ned). */ |
660
627be3ca1ab6
code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
74 @Override |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
75 protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
76 final CallMeta meta = context.getMeta(); |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
77 final 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
|
78 |
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
|
79 for (int i = 0; i < CALCULATIONS.length; ++i) { |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
80 final String calc = CALCULATIONS[i]; |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
81 calcs[i] = createItem(cr, new String[] { Resources.getMsg(meta, calc, calc), calc }); |
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
|
82 } |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
83 |
7f909429ccc8
Added some more calculation types (to the DESCRIBE in the calculation select state).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
84 return calcs; |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
4041
75a90d9d2024
Register new calculation mode 'extreme'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2164
diff
changeset
|
87 /** 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
|
88 @Override |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
89 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7110
diff
changeset
|
90 log.debug("CalculationSelect.validate"); |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
91 final 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
|
92 |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
93 final StateData data = getData(flys, FIELD_MODE); |
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
94 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
|
95 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
96 if (calc == null) { |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
97 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
|
98 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
99 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
100 calc = calc.trim().toLowerCase(); |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
101 |
9638
6c1ebf2220f5
# 19b (check for usages of WaterlevelExporter.getWforGaugeAndQ) -> cleanup: removing calc.extreme.curve
dnt_bjoernsen <d.tironi@bjoernsen.de>
parents:
8202
diff
changeset
|
102 for (final String mode : CALCULATIONS) { |
323
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
103 if (mode.equals(calc)) { |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
104 return true; |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
105 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
106 } |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
107 |
b33ba2cd4a3e
The calculation method is validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
108 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
|
109 } |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 } |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |