annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java @ 3744:b220287a171e

Slightly refactored range with values code to be useful in extreme waterlevels. flys-artifacts/trunk@5427 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 10 Sep 2012 16:52:15 +0000
parents 6342166ccdef
children 96ea983b5c45
rev   line source
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
3 import java.util.ArrayList;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.List;
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
5 import java.util.Comparator;
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
6 import java.util.Collections;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.apache.log4j.Logger;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Element;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.Artifact;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.artifacts.CallContext;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.artifactdatabase.ProtocolUtils;
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
16 import de.intevation.artifactdatabase.data.StateData;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.common.utils.XMLUtils;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.model.Gauge;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.model.Range;
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
22 import de.intevation.flys.model.River;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
23 import de.intevation.flys.model.Wst;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
25 import de.intevation.flys.artifacts.FLYSArtifact;
1055
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
26
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
27 import de.intevation.flys.artifacts.model.RangeWithValues;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
28 import de.intevation.flys.artifacts.model.WstFactory;
1095
f465785ed1ae Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1055
diff changeset
29 import de.intevation.flys.utils.FLYSUtils;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 /**
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
33 * State to input W/Q data.
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 */
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 public class WQAdapted extends DefaultState {
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 /** The logger used in this state.*/
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private static Logger logger = Logger.getLogger(WQAdapted.class);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
2556
efb2038783f9 Renamed state data fields for W/Q input.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2552
diff changeset
41 public static final String FIELD_WQ_MODE = "wq_isq";
401
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
42
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
43 public static final String FIELD_WQ_VALUES = "wq_values";
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
44
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
45 public static final class GaugeOrder implements Comparator<Gauge> {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
46 private int order;
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
47
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
48 public GaugeOrder(boolean up) {
642
2dbbb5be30a1 Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 636
diff changeset
49 order = up ? 1 : -1;
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
50 }
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
51
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
52 public int compare(Gauge a, Gauge b) {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
53 return order * a.getRange().getA().compareTo(b.getRange().getA());
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
54 }
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
55 } // class GaugeOrder
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
56
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
57 public static final GaugeOrder GAUGE_UP = new GaugeOrder(true);
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
58 public static final GaugeOrder GAUGE_DOWN = new GaugeOrder(false);
401
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
59
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
60 /** Trivial, empty constructor. */
660
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 642
diff changeset
61 public WQAdapted() {
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 642
diff changeset
62 }
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 642
diff changeset
63
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
64
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 /**
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 * This method creates one element for each gauge of the selected river that
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 * is intersected by the given kilometer range. Each element is a tuple of
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 * (from;to) where <i>from</i> is the lower bounds of the gauge or the lower
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 * kilometer range. <i>to</i> is the upper bounds of the gauge or the upper
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 * kilometer range.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 *
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 * @param cr The ElementCreator.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * @param artifact The FLYS artifact.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 * @param name The name of the data item.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 * @param context The CallContext.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 *
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 * @return a list of elements that consist of tuples of the intersected
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 * gauges of the selected river.
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 */
660
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 642
diff changeset
80 @Override
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 protected Element[] createItems(
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 XMLUtils.ElementCreator cr,
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 Artifact artifact,
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 String name,
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 CallContext context)
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 {
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 logger.debug("WQAdapted.createItems");
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
401
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
89 if (name != null && name.equals(FIELD_WQ_MODE)) {
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
90 return createModeItems(cr, artifact, name, context);
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
91 }
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
92 else if (name != null && name.equals(FIELD_WQ_VALUES)) {
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
93 return createValueItems(cr, artifact, name, context);
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
94 }
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
95 else {
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
96 logger.warn("Unknown data object: " + name);
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
97 return null;
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
98 }
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
99 }
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
100
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
101
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
102 /** Creates "Q" and "W" items. */
401
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
103 protected Element[] createModeItems(
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
104 XMLUtils.ElementCreator cr,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
105 Artifact artifact,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
106 String name,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
107 CallContext context)
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
108 {
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
109 logger.debug("WQAdapted.createModeItems");
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
110
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
111 Element w = createItem(cr, new String[] { "w", "W" });
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
112 Element q = createItem(cr, new String[] { "q", "Q" });
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
113
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
114 return new Element[] { w, q };
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
115 }
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
116
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
117
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
118 protected Element[] createValueItems(
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
119 XMLUtils.ElementCreator cr,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
120 Artifact artifact,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
121 String name,
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
122 CallContext context)
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
123 {
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
124 logger.debug("WQAdapted.createValueItems");
34de11dcf355 Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 399
diff changeset
125
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
126 FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127
1095
f465785ed1ae Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1055
diff changeset
128 double[] dist = FLYSUtils.getKmRange(flysArtifact);
1103
e0243627ba62 Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
129 River river = FLYSUtils.getRiver(flysArtifact);
681
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
130 Wst wst = WstFactory.getWst(river);
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
131 List<Gauge> gauges = FLYSUtils.getGauges(flysArtifact);
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 int num = gauges != null ? gauges.size() : 0;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 if (num == 0) {
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 logger.warn("Selected distance matches no gauges.");
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 return null;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
140 List<Element> elements = new ArrayList<Element>();
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
142 double rangeFrom = dist[0];
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
143 double rangeTo = dist[1];
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
144
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
145 if (rangeFrom < rangeTo) {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
146 Collections.sort(gauges, GAUGE_UP);
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
147 for (Gauge gauge: gauges) {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
148 Range range = gauge.getRange();
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
149 double lower = range.getA().doubleValue();
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
150 double upper = range.getB().doubleValue();
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
152 // If gauge out of range, skip it.
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
153 if (upper <= rangeFrom || lower >= rangeTo) {
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
154 continue;
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
155 }
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
156
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
157 double from = lower < rangeFrom ? rangeFrom : lower;
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
158 double to = upper > rangeTo ? rangeTo : upper;
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
681
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
160 double[] mmQ = determineMinMaxQ(gauge, wst);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
161 double[] mmW = gauge.determineMinMaxW();
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
162
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
163 elements.add(createItem(
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
164 cr, new String[] { from + ";" + to, ""}, mmQ, mmW));
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
165 }
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
166 }
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
167 else {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
168 Collections.sort(gauges, GAUGE_DOWN);
642
2dbbb5be30a1 Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 636
diff changeset
169 rangeFrom = dist[1];
2dbbb5be30a1 Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 636
diff changeset
170 rangeTo = dist[0];
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
171 for (Gauge gauge: gauges) {
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
172 Range range = gauge.getRange();
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
173 double lower = range.getA().doubleValue();
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
174 double upper = range.getB().doubleValue();
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175
642
2dbbb5be30a1 Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 636
diff changeset
176 double from = lower < rangeFrom ? rangeFrom : lower;
2dbbb5be30a1 Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 636
diff changeset
177 double to = upper > rangeTo ? rangeTo : upper;
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
178
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
179 // TODO probably need to continue out if oof range (see above).
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
180
724
90ee95945684 #164 Create the items for the adapted WQ state with range information for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 681
diff changeset
181 double[] mmQ = determineMinMaxQ(gauge, wst);
90ee95945684 #164 Create the items for the adapted WQ state with range information for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 681
diff changeset
182 double[] mmW = gauge.determineMinMaxW();
90ee95945684 #164 Create the items for the adapted WQ state with range information for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 681
diff changeset
183
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
184 elements.add(createItem(
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
185 cr, new String[] { to + ";" + from, ""}, mmQ, mmW));
636
58276db49b16 Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 624
diff changeset
186 }
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188
3635
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
189 Element[] els = new Element[elements.size()];
6342166ccdef Fix issue774 (wrong items).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3452
diff changeset
190 return elements.toArray(els);
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
681
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
195 return createItem(cr, obj, null, null);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
196 }
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
197
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
198
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
199 protected Element createItem(
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
200 XMLUtils.ElementCreator cr,
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
201 Object obj,
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
202 double[] q,
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
203 double[] w)
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
204 {
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 String[] arr = (String[]) obj;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 label.setTextContent(arr[0]);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 value.setTextContent(arr[1]);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 item.appendChild(label);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 item.appendChild(value);
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216
681
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
217 if (q != null) {
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
218 Element qRange = createRangeElement(cr, q, "Q");
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
219 item.appendChild(qRange);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
220 }
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
221
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
222 if (w != null) {
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
223 Element wRange = createRangeElement(cr, w, "W");
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
224 item.appendChild(wRange);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
225 }
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
226
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 return item;
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230
681
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
231 protected Element createRangeElement(
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
232 XMLUtils.ElementCreator cr,
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
233 double[] mm,
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
234 String type)
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
235 {
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
236 Element range = ProtocolUtils.createArtNode(
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
237 cr, "range",
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
238 new String[] {"type"},
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
239 new String[] {type});
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
240
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
241 Element min = ProtocolUtils.createArtNode(cr, "min", null, null);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
242 min.setTextContent(String.valueOf(mm[0]));
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
243
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
244 Element max = ProtocolUtils.createArtNode(cr, "max", null, null);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
245 max.setTextContent(String.valueOf(mm[1]));
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
246
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
247 range.appendChild(min);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
248 range.appendChild(max);
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
249
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
250 return range;
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
251 }
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
252
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
253
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
254 /**
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
255 * Determines the min and max Q value for the given gauge. If no min and
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
256 * max values could be determined, this method will return
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
257 * [Double.MIN_VALUE, Double.MAX_VALUE].
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
258 *
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
259 * @param gauge
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
260 * @param wst
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
261 *
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
262 * @return the min and max Q values for the given gauge.
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
263 */
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
264 protected double[] determineMinMaxQ(Gauge gauge, Wst wst) {
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
265 logger.debug("WQAdapted.determineMinMaxQ");
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
266
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
267 double[] minmaxQ = gauge != null
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
268 ? wst.determineMinMaxQ(gauge.getRange())
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
269 : null;
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
270
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
271 double minQ = minmaxQ != null ? minmaxQ[0] : Double.MIN_VALUE;
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
272 double maxQ = minmaxQ != null ? minmaxQ[1] : Double.MAX_VALUE;
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
273
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
274 return new double[] { minQ, maxQ };
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
275 }
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
276
dda282dcc44f The min/max W/Q ranges in the panel for calculation4 are written into the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 660
diff changeset
277
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 @Override
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 protected String getUIProvider() {
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 return "wq_panel_adapted";
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 }
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
282
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
283
660
627be3ca1ab6 code clean up in states
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 642
diff changeset
284 @Override
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 724
diff changeset
285 public boolean validate(Artifact artifact)
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
286 throws IllegalArgumentException
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
287 {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
288 logger.debug("WQAdapted.validate");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
289
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
290 FLYSArtifact flys = (FLYSArtifact) artifact;
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: 417
diff changeset
291 StateData data = getData(flys, FIELD_WQ_MODE);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
292
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: 417
diff changeset
293 String mode = data != null ? (String) data.getValue() : null;
2552
c7dbe696286c Refactored the wq data fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1103
diff changeset
294 boolean isQ = mode != null
c7dbe696286c Refactored the wq data fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1103
diff changeset
295 ? Boolean.valueOf(mode)
c7dbe696286c Refactored the wq data fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1103
diff changeset
296 : false;
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
297
2552
c7dbe696286c Refactored the wq data fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1103
diff changeset
298 if (!isQ) {
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 724
diff changeset
299 return validateW(artifact);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
300 }
2552
c7dbe696286c Refactored the wq data fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1103
diff changeset
301 else if (isQ) {
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 724
diff changeset
302 return validateQ(artifact);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
303 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
304 else {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
305 throw new IllegalArgumentException("error_feed_no_wq_mode_selected");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
306 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
307 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
308
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
309
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 724
diff changeset
310 protected boolean validateW(Artifact artifact)
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
311 throws IllegalArgumentException
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
312 {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
313 logger.debug("WQAdapted.validateW");
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
314 FLYSArtifact flys = (FLYSArtifact) artifact;
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
315
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: 417
diff changeset
316 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values"));
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: 417
diff changeset
317
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: 417
diff changeset
318 if (rwvs == null) {
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: 417
diff changeset
319 throw new IllegalArgumentException("error_missing_wq_data");
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: 417
diff changeset
320 }
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: 417
diff changeset
321
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
322 List<Gauge> gauges = FLYSUtils.getGauges((FLYSArtifact) artifact);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
323
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
324 for (Gauge gauge: gauges) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
325 Range range = gauge.getRange();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
326 double lower = range.getA().doubleValue();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
327 double upper = range.getB().doubleValue();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
328
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
329 for (RangeWithValues rwv: rwvs) {
3744
b220287a171e Slightly refactored range with values code to be useful in extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3635
diff changeset
330 if (lower <= rwv.getStart() && upper >= rwv.getEnd()) {
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
331 compareWsWithGauge(gauge, rwv.getValues());
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
332 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
333 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
334 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
335
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
336 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
337 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
338
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
339
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 724
diff changeset
340 protected boolean validateQ(Artifact artifact)
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
341 throws IllegalArgumentException
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
342 {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
343 logger.debug("WQAdapted.validateQ");
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
344 FLYSArtifact flys = (FLYSArtifact) artifact;
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
345
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: 417
diff changeset
346 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values"));
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: 417
diff changeset
347
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: 417
diff changeset
348 if (rwvs == null) {
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: 417
diff changeset
349 throw new IllegalArgumentException("error_missing_wq_data");
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: 417
diff changeset
350 }
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: 417
diff changeset
351
3445
b6c301cb3871 Handle FixationArtifacts in WQAdapted-State.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2556
diff changeset
352 List<Gauge> gauges = FLYSUtils.getGauges(flys);
1103
e0243627ba62 Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
353 River river = FLYSUtils.getRiver(flys);
e0243627ba62 Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
354 Wst wst = WstFactory.getWst(river);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
355
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
356 for (Gauge gauge: gauges) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
357 Range range = gauge.getRange();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
358 double lower = range.getA().doubleValue();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
359 double upper = range.getB().doubleValue();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
360
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
361 for (RangeWithValues rwv: rwvs) {
3744
b220287a171e Slightly refactored range with values code to be useful in extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3635
diff changeset
362 if (lower <= rwv.getStart() && upper >= rwv.getEnd()) {
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
363 compareQsWithGauge(wst, gauge, rwv.getValues());
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
364 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
365 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
366 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
367
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
368 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
369 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
370
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
371
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
372 protected boolean compareQsWithGauge(Wst wst, Gauge gauge, double[] qs)
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
373 throws IllegalArgumentException
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
374 {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
375 double[] minmax = gauge != null
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
376 ? wst.determineMinMaxQ(gauge.getRange())
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
377 : null;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
378
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
379 if (minmax == null) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
380 logger.warn("Could not determine min/max Q of gauge.");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
381 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
382 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
383
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
384 if (logger.isDebugEnabled()) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
385 logger.debug("Validate Qs with:");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
386 logger.debug("-- Gauge: " + gauge.getName());
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
387 logger.debug("-- Gauge min: " + minmax[0]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
388 logger.debug("-- Gauge max: " + minmax[1]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
389 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
390
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
391 for (double q: qs) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
392 if (q < minmax[0] || q > minmax[1]) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
393 throw new IllegalArgumentException(
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
394 "error_feed_q_values_invalid");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
395 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
396 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
397
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
398 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
399 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
400
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
401
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
402 protected boolean compareWsWithGauge(Gauge gauge, double[] ws)
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
403 throws IllegalArgumentException
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
404 {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
405 double[] minmax = gauge != null
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
406 ? gauge.determineMinMaxW()
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
407 : null;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
408
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
409 if (minmax == null) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
410 logger.warn("Could not determine min/max W of gauge.");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
411 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
412 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
413
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
414 if (logger.isDebugEnabled()) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
415 logger.debug("Validate Ws with:");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
416 logger.debug("-- Gauge: " + gauge.getName());
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
417 logger.debug("-- Gauge min: " + minmax[0]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
418 logger.debug("-- Gauge max: " + minmax[1]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
419 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
420
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
421 for (double w: ws) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
422 if (w < minmax[0] || w > minmax[1]) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
423 throw new IllegalArgumentException(
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
424 "error_feed_w_values_invalid");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
425 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
426 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
427
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
428 return true;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
429 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
430
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
431
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
432 protected RangeWithValues[] extractInput(StateData data) {
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: 417
diff changeset
433 if (data == null) {
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: 417
diff changeset
434 return null;
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: 417
diff changeset
435 }
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: 417
diff changeset
436
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
437 String dataString = (String) data.getValue();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
438 String[] ranges = dataString.split(":");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
439
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
440 List<RangeWithValues> rwv = new ArrayList<RangeWithValues>();
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
441
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
442 for (String range: ranges) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
443 String[] parts = range.split(";");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
444
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
445 double lower = Double.parseDouble(parts[0]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
446 double upper = Double.parseDouble(parts[1]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
447
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
448 String[] values = parts[2].split(",");
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
449
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
450 int num = values.length;
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
451 double[] res = new double[num];
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
452
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
453 for (int i = 0; i < num; i++) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
454 try {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
455 res[i] = Double.parseDouble(values[i]);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
456 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
457 catch (NumberFormatException nfe) {
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
458 logger.warn(nfe, nfe);
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
459 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
460 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
461
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
462 rwv.add(new RangeWithValues(lower, upper, res));
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
463 }
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
464
3452
200e70f31f6f Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3450
diff changeset
465 return rwv.toArray(new RangeWithValues[rwv.size()]);
417
e54053bc0e70 Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 401
diff changeset
466 }
399
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
467 }
53cc794fee07 Improved the transition model and added states to enable the 'discharge longitudinal section' computation - NOTE: the work in this computation has not finished yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
468 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org