annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationSelect.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents af13ceeba52a
children 1a7cfeb1ff89 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3284
diff changeset
9 package org.dive4elements.river.artifacts.states;
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 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
12
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 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
14
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
15 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
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3284
diff changeset
17 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3284
diff changeset
18 import org.dive4elements.artifacts.CallContext;
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3284
diff changeset
20 import org.dive4elements.artifacts.common.utils.XMLUtils;
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
21
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3284
diff changeset
22 import org.dive4elements.artifactdatabase.data.StateData;
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
24 import org.dive4elements.river.artifacts.D4EArtifact;
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
25
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 /**
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
28 * This state is used to realize the input of multiple locations as string.
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
29 *
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
30 * The string should be a whitespace separated list of double values where each
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * 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
32 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 * @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
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 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
36
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
37 /** The log used in this class.*/
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
38 private static Logger log = Logger.getLogger(LocationSelect.class);
383
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
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 public LocationSelect() {
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
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
45 /** UI Provider (which input method should the client provide to user. */
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 @Override
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 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
48 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
49 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 @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
53 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
54 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
55 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
56 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
57 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
58 {
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
59 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
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 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
62 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
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 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
65 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
66 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
67 }
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 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
69 log.warn("Could not read min/max distance values!");
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
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
2235
ee5310134463 Cosmetics/care/refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2223
diff changeset
72 if (name.equals(LOCATIONS)) {
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
73 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
74 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
75 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
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 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
78 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
79 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
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 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
82 }
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
83
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
84 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
85 }
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
86
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
87
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2235
diff changeset
88 /** Validates data from 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
89 @Override
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 921
diff changeset
90 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
91 throws IllegalArgumentException
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
93 log.debug("LocationSelect.validate");
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
95 D4EArtifact flys = (D4EArtifact) artifact;
2235
ee5310134463 Cosmetics/care/refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2223
diff changeset
96 StateData data = getData(flys, LOCATIONS);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
2223
6e67b5dd8c4c Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1838
diff changeset
98 String locationStr = data != null
6e67b5dd8c4c Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1838
diff changeset
99 ? (String) data.getValue()
6e67b5dd8c4c Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1838
diff changeset
100 : null;
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 if (locationStr == null || locationStr.length() == 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
103 log.error("No locations given.");
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 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
105 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
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
107 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
108 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
109
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
110 log.debug("Inserted min location: " + mm[0]);
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
111 log.debug("Inserted max location: " + mm[mm.length-1]);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
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
113 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
114 }
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
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 /**
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 * 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
119 * 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
120 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 * @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
122 *
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 * @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
124 */
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 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
126 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
127 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
128
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 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
130 try {
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 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
132 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 catch (NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
134 log.warn(nfe, nfe);
383
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 locations.sort();
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 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
141 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 }
dcc3cd962c0e Enhanced the transition model to reach a state that creates duration curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org