Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 1055:61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
flys-artifacts/trunk@2525 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 22 Aug 2011 15:25:48 +0000 |
parents | eccf966fb677 |
children | e0243627ba62 |
comparison
equal
deleted
inserted
replaced
1054:1f3e944a805c | 1055:61c051e53f9b |
---|---|
16 | 16 |
17 import de.intevation.flys.model.Gauge; | 17 import de.intevation.flys.model.Gauge; |
18 import de.intevation.flys.model.River; | 18 import de.intevation.flys.model.River; |
19 import de.intevation.flys.model.Wst; | 19 import de.intevation.flys.model.Wst; |
20 | 20 |
21 import de.intevation.flys.artifacts.FLYSArtifact; | 21 import de.intevation.flys.artifacts.WINFOArtifact; |
22 | |
22 import de.intevation.flys.artifacts.model.WstFactory; | 23 import de.intevation.flys.artifacts.model.WstFactory; |
23 import de.intevation.flys.artifacts.resources.Resources; | 24 import de.intevation.flys.artifacts.resources.Resources; |
24 | 25 |
25 /** | 26 /** |
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
158 * @return the min and max W values for the current gauge. | 159 * @return the min and max W values for the current gauge. |
159 */ | 160 */ |
160 protected double[] determineMinMaxW(Artifact artifact) { | 161 protected double[] determineMinMaxW(Artifact artifact) { |
161 logger.debug("WQSelect.determineCurrentGauge"); | 162 logger.debug("WQSelect.determineCurrentGauge"); |
162 | 163 |
163 Gauge gauge = ((FLYSArtifact) artifact).getGauge(); | 164 Gauge gauge = ((WINFOArtifact) artifact).getGauge(); |
164 double[] minmaxW = gauge != null ? gauge.determineMinMaxW() : null; | 165 double[] minmaxW = gauge != null ? gauge.determineMinMaxW() : null; |
165 | 166 |
166 double minW = minmaxW != null ? minmaxW[0] : Double.MIN_VALUE; | 167 double minW = minmaxW != null ? minmaxW[0] : Double.MIN_VALUE; |
167 double maxW = minmaxW != null ? minmaxW[1] : Double.MAX_VALUE; | 168 double maxW = minmaxW != null ? minmaxW[1] : Double.MAX_VALUE; |
168 | 169 |
180 * @return the min and max Q values for the current gauge. | 181 * @return the min and max Q values for the current gauge. |
181 */ | 182 */ |
182 protected double[] determineMinMaxQ(Artifact artifact) { | 183 protected double[] determineMinMaxQ(Artifact artifact) { |
183 logger.debug("WQSelect.determineMinMaxQ"); | 184 logger.debug("WQSelect.determineMinMaxQ"); |
184 | 185 |
185 FLYSArtifact flysArtifact = (FLYSArtifact) artifact; | 186 WINFOArtifact flysArtifact = (WINFOArtifact) artifact; |
186 | 187 |
187 River river = flysArtifact.getRiver(); | 188 River river = flysArtifact.getRiver(); |
188 Gauge gauge = flysArtifact.getGauge(); | 189 Gauge gauge = flysArtifact.getGauge(); |
189 Wst wst = WstFactory.getWst(river); | 190 Wst wst = WstFactory.getWst(river); |
190 | 191 |
203 public boolean validate(Artifact artifact) | 204 public boolean validate(Artifact artifact) |
204 throws IllegalArgumentException | 205 throws IllegalArgumentException |
205 { | 206 { |
206 logger.debug("WQSelect.validate"); | 207 logger.debug("WQSelect.validate"); |
207 | 208 |
208 FLYSArtifact flys = (FLYSArtifact) artifact; | 209 WINFOArtifact flys = (WINFOArtifact) artifact; |
209 | 210 |
210 StateData data = getData(flys, WQ_SELECTION); | 211 StateData data = getData(flys, WQ_SELECTION); |
211 String selectionMode = data != null ? (String) data.getValue() : null; | 212 String selectionMode = data != null ? (String) data.getValue() : null; |
212 | 213 |
213 if (selectionMode == null || selectionMode.equals("single")) { | 214 if (selectionMode == null || selectionMode.equals("single")) { |
244 protected boolean validateSingle(Artifact artifact) | 245 protected boolean validateSingle(Artifact artifact) |
245 throws IllegalArgumentException | 246 throws IllegalArgumentException |
246 { | 247 { |
247 logger.debug("WQSelect.validateSingle"); | 248 logger.debug("WQSelect.validateSingle"); |
248 | 249 |
249 FLYSArtifact flys = (FLYSArtifact) artifact; | 250 WINFOArtifact flys = (WINFOArtifact) artifact; |
250 StateData data = getData(flys, WQ_SINGLE); | 251 StateData data = getData(flys, WQ_SINGLE); |
251 | 252 |
252 String tmp = data != null ? (String) data.getValue() : null; | 253 String tmp = data != null ? (String) data.getValue() : null; |
253 | 254 |
254 if (tmp == null || tmp.length() == 0) { | 255 if (tmp == null || tmp.length() == 0) { |
295 | 296 |
296 protected boolean validateRange(Artifact artifact) | 297 protected boolean validateRange(Artifact artifact) |
297 throws IllegalArgumentException | 298 throws IllegalArgumentException |
298 { | 299 { |
299 logger.debug("WQSelect.validateRange"); | 300 logger.debug("WQSelect.validateRange"); |
300 FLYSArtifact flys = (FLYSArtifact) artifact; | 301 WINFOArtifact flys = (WINFOArtifact) artifact; |
301 | 302 |
302 StateData data = flys.getData(WQ_MODE); | 303 StateData data = flys.getData(WQ_MODE); |
303 String mode = data != null ? (String) data.getValue() : null; | 304 String mode = data != null ? (String) data.getValue() : null; |
304 logger.debug("WQ Mode: " + mode); | 305 logger.debug("WQ Mode: " + mode); |
305 | 306 |