annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java @ 704:eab5e5089d77

Merged revisions 2127-2133,2136-2137,2140,2143-2144,2146,2150-2151,2153-2154 via svnmerge from svn+ssh://teichmann@thoe/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/flys-artifacts/branches/facets-slt ........ r2127 | ingo | 2011-06-16 09:50:56 +0200 (Do, 16 Jun 2011) | 1 line Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states. ........ r2128 | ingo | 2011-06-16 10:25:06 +0200 (Do, 16 Jun 2011) | 1 line Moved Waterlevel state into the correct package. ........ r2129 | ingo | 2011-06-16 10:43:58 +0200 (Do, 16 Jun 2011) | 1 line Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact. ........ r2130 | ingo | 2011-06-16 10:57:05 +0200 (Do, 16 Jun 2011) | 1 line Use enums to dispatch computeFeed() and computeAdvance(). ........ r2131 | ingo | 2011-06-16 11:04:59 +0200 (Do, 16 Jun 2011) | 1 line Store facets for each state. ........ r2132 | ingo | 2011-06-16 12:05:44 +0200 (Do, 16 Jun 2011) | 1 line Generated facets for each output aspect. ........ r2133 | ingo | 2011-06-16 15:24:00 +0200 (Do, 16 Jun 2011) | 1 line Write computed facets into artifacts describe document. ........ r2136 | ingo | 2011-06-16 16:10:49 +0200 (Do, 16 Jun 2011) | 1 line Add index and description of facets to collections describe document. ........ r2137 | ingo | 2011-06-16 16:31:41 +0200 (Do, 16 Jun 2011) | 1 line OutGenerators doOut() takes a facet object now instead of just its name. ........ r2140 | ingo | 2011-06-17 11:19:43 +0200 (Fr, 17 Jun 2011) | 1 line OutGenerators use now facets to fetch necessary data. ........ r2143 | teichmann | 2011-06-17 12:40:54 +0200 (Fr, 17 Jun 2011) | 1 line Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again. ........ r2144 | teichmann | 2011-06-17 13:08:31 +0200 (Fr, 17 Jun 2011) | 1 line make getGauges() more robust ........ r2146 | teichmann | 2011-06-17 13:23:57 +0200 (Fr, 17 Jun 2011) | 1 line mico opt: inter cmps are faster than str cmps. ........ r2150 | teichmann | 2011-06-17 15:10:20 +0200 (Fr, 17 Jun 2011) | 1 line call computeAdvance() if we want to advance. ........ r2151 | teichmann | 2011-06-17 15:45:50 +0200 (Fr, 17 Jun 2011) | 1 line Base WST/CSV exports on facets. TODO: generate the facets. ........ r2153 | teichmann | 2011-06-17 16:03:29 +0200 (Fr, 17 Jun 2011) | 1 line Add facet to access raw computed data. ........ r2154 | teichmann | 2011-06-17 16:37:09 +0200 (Fr, 17 Jun 2011) | 1 line Generate data facets for the computed states. ........ flys-artifacts/trunk@2156 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 17 Jun 2011 16:17:03 +0000
parents 9a035ef7b595
children 610d0e0f4f85
rev   line source
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import gnu.trove.TDoubleArrayList;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
679
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
7 import org.w3c.dom.Element;
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
8
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.artifacts.Artifact;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.artifacts.CallContext;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
679
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
12 import de.intevation.artifacts.common.utils.XMLUtils;
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
13
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import de.intevation.artifactdatabase.data.StateData;
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
624
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
16 import de.intevation.flys.artifacts.FLYSArtifact;
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
17
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 /**
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 * This state is used to realize the input of multiple locations as string. The
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 * string should be a whitespace separated list of double values where each
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 * double value represents a location.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public class LocationSelect extends LocationDistanceSelect {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /** The logger used in this class.*/
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 private static Logger logger = Logger.getLogger(LocationSelect.class);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 /** The name of the StateData object that stores the location string.*/
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public static final String FIELD_LOCATIONS = "ld_locations";
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 public LocationSelect() {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 @Override
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 protected String getUIProvider() {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 return "location_panel";
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 @Override
679
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
47 protected Element[] createItems(
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
48 XMLUtils.ElementCreator cr,
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
49 Artifact artifact,
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
50 String name,
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
51 CallContext context)
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
52 {
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
53 double[] minmax = getMinMaxDistance(artifact);
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
54
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
55 double minVal = Double.MIN_VALUE;
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
56 double maxVal = Double.MAX_VALUE;
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
57
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
58 if (minmax != null) {
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
59 minVal = minmax[0];
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
60 maxVal = minmax[1];
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
61 }
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
62 else {
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
63 logger.warn("Could not read min/max distance values!");
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
64 }
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
65
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
66 if (name.equals(FIELD_LOCATIONS)) {
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
67 Element min = createItem(
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
68 cr,
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
69 new String[] {"min", new Double(minVal).toString()});
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
70
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
71 Element max = createItem(
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
72 cr,
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
73 new String[] {"max", new Double(maxVal).toString()});
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
74
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
75 return new Element[] { min, max };
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
76 }
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
77
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
78 return null;
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
79 }
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
80
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
81
9a035ef7b595 The state that is used to enter locations writes the river's range into the DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 624
diff changeset
82 @Override
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 public boolean validate(Artifact artifact, CallContext context)
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 throws IllegalArgumentException
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 logger.debug("LocationSelect.validate");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
624
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
88 FLYSArtifact flys = (FLYSArtifact) artifact;
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
89 StateData data = getData(flys, FIELD_LOCATIONS);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
624
929137ee8154 ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
91 String locationStr = data != null ? (String) data.getValue() : null;
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 if (locationStr == null || locationStr.length() == 0) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 logger.error("No locations given.");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 throw new IllegalArgumentException("error_empty_state");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 double[] minmax = getMinMaxDistance(artifact);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 double[] mm = extractLocations(locationStr);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 logger.debug("Inserted min location: " + mm[0]);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 logger.debug("Inserted max location: " + mm[mm.length-1]);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 383
diff changeset
104 return validateBounds(minmax[0], minmax[1], mm[0], mm[mm.length-1], 0d);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 /**
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 * This method takes a string that consist of whitespace separated double
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 * values and returns the double values as array.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 * @param locationStr The locations inserted in this state.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 * @return the locations as array.
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 protected double[] extractLocations(String locationStr) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 String[] tmp = locationStr.split(" ");
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 TDoubleArrayList locations = new TDoubleArrayList();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 for (String l: tmp) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 try {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 locations.add(Double.parseDouble(l));
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 catch (NumberFormatException nfe) {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 logger.warn(nfe, nfe);
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 locations.sort();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 return locations.toNativeArray();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org