annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 400:7e5c2e93e449

Changed the y-axis title of the computed discharge curve. flys-artifacts/trunk@1835 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 May 2011 12:31:28 +0000
parents c21fb8de54f8
children 929137ee8154
rev   line source
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
3 import java.util.Map;
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
4
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
5 import gnu.trove.TDoubleArrayList;
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
6
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Element;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
11 import de.intevation.artifacts.Artifact;
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.CallContext;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.common.utils.XMLUtils;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.artifactdatabase.ProtocolUtils;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.artifactdatabase.data.StateData;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
19 import de.intevation.flys.model.Gauge;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
20 import de.intevation.flys.model.River;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
21 import de.intevation.flys.model.Wst;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
22
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
23 import de.intevation.flys.artifacts.FLYSArtifact;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
24 import de.intevation.flys.artifacts.model.WstFactory;
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.artifacts.resources.Resources;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 /**
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 */
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
30 public class WQSelect extends RangeState {
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 /** The logger used in this class.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private static Logger logger = Logger.getLogger(WQSelect.class);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 /** The default step width for Qs.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public static final String DEFAULT_STEP_Q = "50";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 /** The default step width for Qs.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public static final String DEFAULT_STEP_W = "30";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
42 /** The name of the 'mode' field. */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
43 public static final String WQ_MODE = "wq_mode";
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
44
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
45 /** The name of the 'selection' field.*/
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
46 public static final String WQ_SELECTION = "wq_selection";
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
47
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
48 /** The name of the 'from' field. */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
49 public static final String WQ_FROM = "wq_from";
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
50
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
51 /** The name of the 'to' field. */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
52 public static final String WQ_TO = "wq_to";
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
53
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
54 /** The name of the 'step' field. */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
55 public static final String WQ_STEP = "wq_step";
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
56
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
57 /** The name of the 'single' field. */
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
58 public static final String WQ_SINGLE = "wq_single";
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
59
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
60
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 /**
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 * The default constructor that initializes an empty State object.
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 */
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 public WQSelect() {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 protected Element createData(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 XMLUtils.ElementCreator cr,
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
69 Artifact artifact,
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 StateData data,
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 CallContext context)
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 Element select = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 cr, "select", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 cr.addAttr(select, "name", data.getName(), true);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 Element label = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 cr, "label", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 Element choices = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 cr, "choices", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 label.setTextContent(Resources.getMsg(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 context.getMeta(),
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 data.getName(),
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 data.getName()));
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 select.appendChild(label);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return select;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 protected Element[] createItems(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 XMLUtils.ElementCreator cr,
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
97 Artifact artifact,
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 String name,
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 CallContext context)
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 // TODO Insert correct min/max values!
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
102 double[] minmaxW = determineMinMaxW(artifact);
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
103 double[] minmaxQ = determineMinMaxQ(artifact);
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 if (name.equals("wq_from")) {
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
106 Element minW = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
107 cr, new String[] {"minW", new Double(minmaxW[0]).toString()});
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
108 Element minQ = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
109 cr, new String[] {"minQ", new Double(minmaxQ[0]).toString()});
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 return new Element[] { minW, minQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 else if (name.equals("wq_to")) {
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
113 Element maxW = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
114 cr, new String[] {"maxW", new Double(minmaxW[1]).toString()});
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
115 Element maxQ = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
116 cr, new String[] {"maxQ", new Double(minmaxQ[1]).toString()});
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 return new Element[] { maxW, maxQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 else {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 Element stepW = createItem(cr, new String[] {"stepW", DEFAULT_STEP_W});
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 Element stepQ = createItem(cr, new String[] {"stepQ", DEFAULT_STEP_Q});
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 return new Element[] { stepW, stepQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 String[] arr = (String[]) obj;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 label.setTextContent(arr[0]);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 value.setTextContent(arr[1]);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 item.appendChild(label);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 item.appendChild(value);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 return item;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 protected String getUIProvider() {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 return "wq_panel";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 }
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
147
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
148
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
149 /**
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
150 * Determines the min and max W value for the current gauge. If no min and
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
151 * max values could be determined, this method will return
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
152 * [Double.MIN_VALUE, Double.MAX_VALUE].
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
153 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
154 * @param artifact The FLYSArtifact.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
155 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
156 * @return the min and max W values for the current gauge.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
157 */
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
158 protected double[] determineMinMaxW(Artifact artifact) {
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
159 logger.debug("WQSelect.determineCurrentGauge");
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
160
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
161 Gauge gauge = ((FLYSArtifact) artifact).getGauge();
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
162 double[] minmaxW = gauge != null ? gauge.determineMinMaxW() : null;
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
163
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
164 double minW = minmaxW != null ? minmaxW[0] : Double.MIN_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
165 double maxW = minmaxW != null ? minmaxW[1] : Double.MAX_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
166
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
167 return new double[] { minW, maxW };
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
168 }
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
169
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
170
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
171 /**
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
172 * Determines the min and max Q value for the current gauge. If no min and
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
173 * max values could be determined, this method will return
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
174 * [Double.MIN_VALUE, Double.MAX_VALUE].
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
175 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
176 * @param artifact The FLYSArtifact.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
177 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
178 * @return the min and max Q values for the current gauge.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
179 */
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
180 protected double[] determineMinMaxQ(Artifact artifact) {
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
181 logger.debug("WQSelect.determineMinMaxQ");
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
182
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
183 FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
184
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
185 River river = flysArtifact.getRiver();
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
186 Gauge gauge = flysArtifact.getGauge();
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
187 Wst wst = WstFactory.getWst(river);
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
188
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
189 double[] minmaxQ = gauge != null
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
190 ? wst.determineMinMaxQ(gauge.getRange())
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
191 : null;
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
192
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
193 double minQ = minmaxQ != null ? minmaxQ[0] : Double.MIN_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
194 double maxQ = minmaxQ != null ? minmaxQ[1] : Double.MAX_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
195
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
196 return new double[] { minQ, maxQ };
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
197 }
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
198
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
199
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
200 @Override
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
201 public boolean validate(Artifact artifact, CallContext context)
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
202 throws IllegalArgumentException
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
203 {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
204 logger.debug("WQSelect.validate");
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
205
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
206 Map<String, StateData> data = getData();
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
207
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
208 String selectionMode = (String) data.get(WQ_SELECTION).getValue();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
209
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
210 if (selectionMode == null || selectionMode.equals("single")) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
211 return validateSingle(artifact, context);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
212 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
213 else {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
214 return validateRange(artifact, context);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
215 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
216 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
217
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
218
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
219 protected boolean validateSingle(Artifact artifact, CallContext context)
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
220 throws IllegalArgumentException
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
221 {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
222 logger.debug("WQSelect.validateSingle");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
223
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
224 String tmp = (String) data.get(WQ_SINGLE).getValue();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
225
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
226 if (tmp == null || tmp.length() == 0) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
227 throw new IllegalArgumentException("error_empty_state");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
228 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
229
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
230 String[] strValues = tmp.split(" ");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
231 TDoubleArrayList all = new TDoubleArrayList();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
232
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
233 for (String strValue: strValues) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
234 try {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
235 all.add(Double.parseDouble(strValue));
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
236 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
237 catch (NumberFormatException nfe) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
238 logger.warn(nfe, nfe);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
239 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
240 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
241
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
242 all.sort();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
243
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
244 String mode = (String) data.get(WQ_MODE).getValue();
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
245 logger.debug("WQ Mode: " + mode);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
246
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
247 double[] minmax = null;
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
248
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
249 if (mode != null && mode.trim().toLowerCase().equals("w")) {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
250 minmax = determineMinMaxW(artifact);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
251 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
252 else {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
253 minmax = determineMinMaxQ(artifact);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
254 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
255
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
256 double min = all.get(0);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
257 double max = all.get(all.size()-1);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
258
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
259 logger.debug("Inserted min value = " + min);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
260 logger.debug("Inserted max value = " + max);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
261
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
262 return validateBounds(minmax[0], minmax[1], min, max, 0d);
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
263 }
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
264
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
265
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
266 protected boolean validateRange(Artifact artifact, CallContext context)
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
267 throws IllegalArgumentException
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
268 {
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
269 logger.debug("WQSelect.validateRange");
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
270
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
271 String mode = (String) data.get(WQ_MODE).getValue();
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
272 logger.debug("WQ Mode: " + mode);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
273
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
274 String fromStr = (String) data.get(WQ_FROM).getValue();
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
275 String toStr = (String) data.get(WQ_TO).getValue();
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
276 String stepStr = (String) data.get(WQ_STEP).getValue();
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
277
352
ed3325a0232a Throw an illegal argument exception in LocationDistanceSelect.validate() and WQSelect.validate() if no data has been inserted so far.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
278 if (fromStr == null || toStr == null || stepStr == null) {
ed3325a0232a Throw an illegal argument exception in LocationDistanceSelect.validate() and WQSelect.validate() if no data has been inserted so far.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
279 throw new IllegalArgumentException("error_empty_state");
ed3325a0232a Throw an illegal argument exception in LocationDistanceSelect.validate() and WQSelect.validate() if no data has been inserted so far.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
280 }
ed3325a0232a Throw an illegal argument exception in LocationDistanceSelect.validate() and WQSelect.validate() if no data has been inserted so far.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 322
diff changeset
281
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
282 double from = Double.parseDouble(fromStr);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
283 double to = Double.parseDouble(toStr);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
284 double step = Double.parseDouble(stepStr);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
285
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
286 try {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
287 if (mode != null && mode.trim().toLowerCase().equals("w")) {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
288 return validateW(artifact, context, from, to, step);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
289 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
290 else if (mode != null && mode.trim().toLowerCase().equals("q")) {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
291 return validateQ(artifact, context, from, to, step);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
292 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
293 else {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
294 throw new IllegalArgumentException("error_feed_invalid_wq_mode");
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
295 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
296 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
297 catch (NumberFormatException nfe) {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
298 throw new IllegalArgumentException("error_feed_number_format");
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
299 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
300 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
301
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
302
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
303 /**
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
304 * Validates the inserted W values.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
305 *
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
306 * @param artifact The owner artifact.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
307 * @param context The CallContext
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
308 * @param from The lower value of the W range.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
309 * @param to The upper value of the W range.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
310 * @param step The step width.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
311 *
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
312 * @return true, if everything was fine, otherwise an exception is thrown.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
313 */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
314 protected boolean validateW(
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
315 Artifact artifact,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
316 CallContext context,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
317 double from,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
318 double to,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
319 double step)
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
320 throws IllegalArgumentException
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
321 {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
322 logger.debug("WQSelect.validateW");
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
323
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
324 double[] minmaxW = determineMinMaxW(artifact);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
325
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
326 return validateBounds(minmaxW[0], minmaxW[1], from, to, step);
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
327 }
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
328
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
329
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
330 /**
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
331 * Validates the inserted Q values.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
332 *
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
333 * @param artifact The owner artifact.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
334 * @param context The CallContext
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
335 * @param from The lower value of the Q range.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
336 * @param to The upper value of the Q range.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
337 * @param step The step width.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
338 *
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
339 * @return true, if everything was fine, otherwise an exception is thrown.
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
340 */
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
341 protected boolean validateQ(
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
342 Artifact artifact,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
343 CallContext context,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
344 double from,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
345 double to,
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
346 double step)
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
347 throws IllegalArgumentException
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
348 {
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
349 logger.debug("WQSelect.validateQ");
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
350
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
351 double[] minmaxQ = determineMinMaxQ(artifact);
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
352
379
c21fb8de54f8 Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 352
diff changeset
353 return validateBounds(minmaxQ[0], minmaxQ[1], from, to, step);
322
448d0dc64357 The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 320
diff changeset
354 }
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
355 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org