annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java @ 2155:8c9c40459d8f

Respect rivers flow direction when looking for hyk-formations. flys-artifacts/trunk@3738 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 20 Jan 2012 09:38:43 +0000
parents 853cd2120d69
children 6e67b5dd8c4c
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 /** 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
32 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
33
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 public LocationSelect() {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 }
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 @Override
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 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
41 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
42 }
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 @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
46 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
47 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
48 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
49 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
50 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
51 {
921
610d0e0f4f85 #159 Modifications in the transition model to support a state with a kilometer range input only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 679
diff changeset
52 double[] minmax = getMinMax(artifact);
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
53
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 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
55 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
56
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 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
58 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
59 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
60 }
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 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
62 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
63 }
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 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
66 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
67 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
68 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
69
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 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
71 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
72 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
73
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 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
75 }
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 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
78 }
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 @Override
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 921
diff changeset
82 public boolean validate(Artifact artifact)
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 throws IllegalArgumentException
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 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
86
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
87 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
88 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
89
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
90 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
91
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 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
93 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
94 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
95 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
921
610d0e0f4f85 #159 Modifications in the transition model to support a state with a kilometer range input only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 679
diff changeset
97 double[] minmax = getMinMax(artifact);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 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
99
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 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
101 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
102
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
103 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
104 }
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 * 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
109 * 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
110 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 * @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
112 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 * @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
114 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 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
116 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
117 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
118
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 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
120 try {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 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
122 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 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
124 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
125 }
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 locations.sort();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 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
131 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org