Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java @ 634:d8c47520c726
Round exploded values to a precision of 1e-6.
flys-artifacts/trunk@2008 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 26 May 2011 09:41:57 +0000 |
parents | 929137ee8154 |
children | 58276db49b16 |
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; |
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
|
5 |
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
|
6 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
|
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.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
|
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 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
|
11 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
|
12 |
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.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
|
14 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
|
15 |
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
|
16 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
|
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.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
|
19 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
|
20 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
|
21 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
|
22 |
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
|
23 import de.intevation.flys.artifacts.FLYSArtifact; |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
24 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
|
25 import de.intevation.flys.artifacts.model.WstFactory; |
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
|
26 |
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
|
27 |
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
|
28 /** |
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
|
29 * @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
|
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 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
|
32 |
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
|
33 /** 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
|
34 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
|
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 |
401
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
37 public static final String FIELD_WQ_MODE = "wq_mode"; |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
38 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
39 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
|
40 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
41 |
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
|
42 /** |
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
|
43 * 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
|
44 * 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
|
45 * (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
|
46 * 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
|
47 * 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
|
48 * |
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
|
49 * @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
|
50 * @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
|
51 * @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
|
52 * @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
|
53 * |
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
|
54 * @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
|
55 * 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
|
56 */ |
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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 { |
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
|
63 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
|
64 |
401
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
65 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
|
66 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
|
67 } |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
68 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
|
69 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
|
70 } |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
71 else { |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
72 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
|
73 return null; |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
74 } |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
75 } |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
76 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
77 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
78 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
|
79 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
|
80 Artifact artifact, |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
81 String name, |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
82 CallContext context) |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
83 { |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
84 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
|
85 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
86 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
|
87 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
|
88 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
89 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
|
90 } |
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 |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
93 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
|
94 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
|
95 Artifact artifact, |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
96 String name, |
34de11dcf355
Small bugfix in the adapted WQ state and further i18n strings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
399
diff
changeset
|
97 CallContext context) |
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 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
|
100 |
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
|
101 FLYSArtifact flysArtifact = (FLYSArtifact) 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
|
102 |
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
|
103 double[] dist = flysArtifact.getDistance(); |
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
|
104 List<Gauge> gauges = flysArtifact.getGauges(); |
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
|
105 |
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
|
106 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
|
107 |
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
|
108 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
|
109 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
|
110 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
|
111 } |
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
|
112 |
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
|
113 Element[] elements = new Element[num]; |
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
|
114 |
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
|
115 int idx = 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
|
116 |
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
|
117 for (Gauge gauge: 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
|
118 Range range = gauge.getRange(); |
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
|
119 double lower = range.getA().doubleValue(); |
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
|
120 double upper = range.getB().doubleValue(); |
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
|
121 |
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
|
122 double from = dist[0] < lower ? lower : dist[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
|
123 double to = dist[1] > upper ? upper : dist[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
|
124 |
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
|
125 String key = Double.toString(from) + ";" + Double.toString(to); |
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
|
126 |
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 elements[idx++] = createItem(cr, new String[] {key, ""}); |
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
|
128 } |
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
|
129 |
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
|
130 return elements; |
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
|
131 } |
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 |
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 protected Element createItem(XMLUtils.ElementCreator cr, Object 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
|
135 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
|
136 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
|
137 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
|
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 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
|
140 |
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 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
|
142 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
|
143 |
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
|
144 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
|
145 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
|
146 |
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
|
147 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
|
148 } |
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
|
149 |
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
|
150 |
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 @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
|
152 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
|
153 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
|
154 } |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
155 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
156 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
157 public boolean validate(Artifact artifact, CallContext context) |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
158 throws IllegalArgumentException |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
159 { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
160 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
|
161 |
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
|
162 FLYSArtifact flys = (FLYSArtifact) artifact; |
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
|
163 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
|
164 |
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
|
165 String mode = data != null ? (String) data.getValue() : null; |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
166 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
167 if (mode != null && mode.equals("W")) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
168 return validateW(artifact, context); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
169 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
170 else if (mode != null && mode.equals("Q")) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
171 return validateQ(artifact, context); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
172 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
173 else { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
174 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
|
175 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
176 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
177 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
178 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
179 protected boolean validateW(Artifact artifact, CallContext context) |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
180 throws IllegalArgumentException |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
181 { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
182 logger.debug("WQAdapted.validateW"); |
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
|
183 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
|
184 |
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
|
185 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
|
186 |
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
|
187 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
|
188 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
|
189 } |
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
|
190 |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
191 List<Gauge> gauges = ((FLYSArtifact) artifact).getGauges(); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
192 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
198 for (RangeWithValues rwv: rwvs) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
199 if (lower <= rwv.getLower() && upper >= rwv.getUpper()) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
200 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
|
201 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
202 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
203 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
204 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
205 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
206 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
207 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
208 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
209 protected boolean validateQ(Artifact artifact, CallContext context) |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
210 throws IllegalArgumentException |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
211 { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
212 logger.debug("WQAdapted.validateQ"); |
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
|
213 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
|
214 |
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
|
215 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
|
216 |
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
|
217 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
|
218 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
|
219 } |
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
|
220 |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
221 List<Gauge> gauges = ((FLYSArtifact) artifact).getGauges(); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
222 River river = ((FLYSArtifact) artifact).getRiver(); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
223 Wst wst = WstFactory.getWst(river); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
224 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
230 for (RangeWithValues rwv: rwvs) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
231 if (lower <= rwv.getLower() && upper >= rwv.getUpper()) { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
232 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
|
233 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
234 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
235 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
236 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
237 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
238 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
239 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
240 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
241 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
|
242 throws IllegalArgumentException |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
243 { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
244 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
|
245 ? 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
|
246 : null; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
247 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
248 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
|
249 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
|
250 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
251 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
252 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
259 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 "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
|
264 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
265 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
266 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
267 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
268 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
269 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
270 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
271 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
|
272 throws IllegalArgumentException |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
273 { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
274 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
|
275 ? gauge.determineMinMaxW() |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
276 : null; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
277 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
278 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
|
279 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
|
280 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
281 } |
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 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
289 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 "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
|
294 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
295 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
296 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
297 return true; |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
298 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
299 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
300 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 } |
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
|
305 |
417
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
306 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
|
307 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
|
308 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
309 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
|
310 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
311 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
|
312 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
|
313 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
314 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
|
315 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
|
316 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
317 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
|
318 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
319 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
|
320 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
|
321 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
322 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
|
323 try { |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
324 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
|
325 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
326 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
|
327 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
|
328 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
329 } |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
330 |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
331 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
|
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 return (RangeWithValues[]) rwv.toArray(new RangeWithValues[rwv.size()]); |
e54053bc0e70
Implemented the input validation of WQ in the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
401
diff
changeset
|
335 } |
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
|
336 } |
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
|
337 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |