Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 354:542f280d72c3
Bugfix: Added the missing init() method to a Transition and call it in the TransitionFactory after a Transition has been created.
flys-artifacts/trunk@1761 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 28 Apr 2011 11:16:21 +0000 |
parents | ed3325a0232a |
children | c21fb8de54f8 |
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 |
137
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 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
|
6 |
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.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
|
8 |
313
89bd0417418f
The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
137
diff
changeset
|
9 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
|
10 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
|
11 |
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.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
|
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.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
|
15 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
|
16 |
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
|
17 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
|
18 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
|
19 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
|
20 |
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.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
|
22 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
|
23 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
|
24 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 /** |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 * @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
|
27 */ |
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
|
28 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
|
29 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** 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
|
31 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
|
32 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 /** 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
|
35 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
|
36 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 /** 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
|
38 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
|
39 |
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
|
40 /** 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
|
41 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
|
42 |
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 /** 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
|
44 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
|
45 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
46 /** 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
|
47 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
|
48 |
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 /** 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
|
50 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
|
51 |
137
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 /** |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * 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
|
54 */ |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 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
|
56 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
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 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
|
65 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
|
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 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
|
68 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 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
|
70 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
|
71 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 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
|
73 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
|
74 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 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
|
81 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 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
|
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 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 { |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 // 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
|
93 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
|
94 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
|
95 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 else { |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 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
|
119 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
|
120 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
|
121 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
|
122 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 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
|
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 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
|
126 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
|
127 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 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
|
129 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
|
130 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 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
|
132 } |
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 |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 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
|
136 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
|
137 } |
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
|
138 |
d8558dd64152
The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
139 |
d8558dd64152
The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
140 /** |
d8558dd64152
The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
141 * 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
|
142 * 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
|
143 * [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
|
144 * |
d8558dd64152
The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
145 * @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
|
146 * |
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 * @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
|
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 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
|
150 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
|
151 |
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 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
|
153 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
|
154 |
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 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
|
156 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
|
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 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
|
159 } |
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 |
d8558dd64152
The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
313
diff
changeset
|
162 /** |
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 * 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
|
164 * 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
|
165 * [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
|
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 * @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
|
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 * @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
|
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 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
|
172 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
|
173 |
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 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
|
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 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
|
177 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
|
178 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
|
179 |
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
|
180 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
|
181 ? 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
|
182 : 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
|
183 |
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 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
|
185 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
|
186 |
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 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
|
188 } |
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
|
189 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
190 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
191 @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
|
192 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
|
193 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
|
194 { |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
195 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
|
196 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
197 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
|
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 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
|
200 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
|
201 |
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 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
|
203 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
|
204 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
|
205 |
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
|
206 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
|
207 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
|
208 } |
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
|
209 |
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
|
210 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
|
211 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
|
212 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
|
213 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
214 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
|
215 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
|
216 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
|
217 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
218 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
|
219 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
|
220 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
221 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
|
222 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
|
223 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
224 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
225 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
|
226 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
|
227 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
228 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
229 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
230 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
231 /** |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
232 * 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
|
233 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
234 * @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
|
235 * @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
|
236 * @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
|
237 * @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
|
238 * @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
|
239 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
240 * @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
|
241 */ |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 { |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
250 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
|
251 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
252 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
|
253 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
254 return validateRange(minmaxW[0], minmaxW[1], 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
|
255 } |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
256 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
257 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
258 /** |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
259 * 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
|
260 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
261 * @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
|
262 * @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
|
263 * @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
|
264 * @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
|
265 * @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
|
266 * |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
267 * @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
|
268 */ |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
269 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
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 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
|
276 { |
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 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
|
278 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
279 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
|
280 |
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
320
diff
changeset
|
281 return validateRange(minmaxQ[0], minmaxQ[1], 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
|
282 } |
137
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 } |
7f839b81cdde
Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |