Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java @ 4496:d8992459b408
Add method to return the facets of an artifact
This methos should be used to get the facets of an artifact instead of accessing
the facets member variable directly.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 14 Nov 2012 11:11:04 +0100 |
parents | 810db532803a |
children | f8217f1fef2e |
rev | line source |
---|---|
4116
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states.extreme; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.Artifact; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.access.ExtremeAccess; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifactdatabase.ProtocolUtils; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifactdatabase.data.StateData; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.artifacts.model.RiverFactory; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.artifacts.model.WstValueTable; |
4197
810db532803a
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4116
diff
changeset
|
22 /* |
4116
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.flys.model.Gauge; |
4197
810db532803a
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4116
diff
changeset
|
24 import de.intevation.flys.model.Wst; |
810db532803a
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4116
diff
changeset
|
25 import de.intevation.flys.utils.FLYSUtils; |
810db532803a
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4116
diff
changeset
|
26 */ |
4116
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.artifacts.model.Range; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.model.River; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.artifacts.FLYSArtifact; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.flys.artifacts.model.RangeWithValues; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.flys.artifacts.states.DefaultState; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 /** TODO Subclass WQAdapted. */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 /** |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * State to input Q data in segments for extreme value calculations.. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * The data item ranges is expected to have this format <from1>;<to1>;<value1>:<from2>;<to2>;<value2>:... |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * (;;;:;;;:;;;:...) |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 public class ExtremeQInput extends DefaultState { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** The logger used in this state.*/ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 private static Logger logger = Logger.getLogger(ExtremeQInput.class); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 /** Trivial, empty constructor. */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 public ExtremeQInput() { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 /** |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 * Create one element for each 'segment' of the selected river that |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 * is within the given kilometer range (TODO). Each element is a tuple of |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 * (from;to) where <i>from</i> is the lower bounds of the segment or the |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 * lower kilometer range. <i>to</i> is the upper bounds of the segment or |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 * the upper kilometer range. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 * |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 * @param cr The ElementCreator. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * @param artifact The FLYS artifact. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 * @param name The name of the data item. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 * @param context The CallContext. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 * |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 * @return a list of elements that consist of tuples of the intersected |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 * segments of the selected river. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 @Override |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 protected Element[] createItems( |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 XMLUtils.ElementCreator cr, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 Artifact artifact, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 String name, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 CallContext context) |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 logger.debug("ExtremeQInput.createItems: " + name); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 FLYSArtifact flysArtifact = (FLYSArtifact) artifact; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 ExtremeAccess access = new ExtremeAccess(flysArtifact); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 River river = RiverFactory.getRiver(access.getRiver()); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 WstValueTable wstValueTable = WstValueTableFactory.getTable(river); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 List<Range> ranges = wstValueTable.findSegments(access.getFrom(), |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 access.getTo()); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 int num = ranges != null ? ranges.size() : 0; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 if (num == 0) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 logger.warn("Selected distance matches no segments."); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 return null; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 List<Element> elements = new ArrayList<Element>(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 for (Range range: ranges) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 elements.add(createItem( |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 cr, new String[] { range.getStart() + ";" + range.getEnd(), ""}, new double[] {0,100000})); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 Element[] els = new Element[elements.size()]; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 return elements.toArray(els); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 /** Create sub-item ('row') of data thing. */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 protected Element createItem( |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 XMLUtils.ElementCreator cr, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 Object obj, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 double[] q |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 ) |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 Element label = ProtocolUtils.createArtNode(cr, "label", null, null); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 Element value = ProtocolUtils.createArtNode(cr, "value", null, null); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 String[] arr = (String[]) obj; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 label.setTextContent(arr[0]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 value.setTextContent(arr[1]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 item.appendChild(label); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 item.appendChild(value); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 if (q != null) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 Element qRange = createRangeElement(cr, q, "Q"); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 item.appendChild(qRange); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 return item; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 /** |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 * Create elements to set min and max values of segments q (just min makes |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 * sense for extremes. |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 protected Element createRangeElement( |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 XMLUtils.ElementCreator cr, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 double[] mm, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 String type) |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 Element range = ProtocolUtils.createArtNode( |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 cr, "range", |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 new String[] {"type"}, |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 new String[] {type}); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 Element min = ProtocolUtils.createArtNode(cr, "min", null, null); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 min.setTextContent(String.valueOf(mm[0])); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 Element max = ProtocolUtils.createArtNode(cr, "max", null, null); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 max.setTextContent(String.valueOf(mm[1])); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 range.appendChild(min); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 range.appendChild(max); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 return range; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 @Override |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 protected String getUIProvider() { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 return "q_segmented_panel"; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 /** Validate given data (return true). */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 @Override |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 public boolean validate(Artifact artifact) |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 throws IllegalArgumentException |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 logger.debug("ExtremeQInput.validate"); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 FLYSArtifact flys = (FLYSArtifact) artifact; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 logger.debug("ExtremeQInput: " + getData(flys, "ranges")); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 /* |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 // TODO sort out what has to be validated (prevent negative values?). |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 RangeWithValues[] rwvs = extractInput(getData(flys, "ranges")); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 if (rwvs == null) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 throw new IllegalArgumentException("error_missing_wq_data"); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 List<Gauge> gauges = FLYSUtils.getGauges(flys); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 River river = FLYSUtils.getRiver(flys); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 Wst wst = WstFactory.getWst(river); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 for (Gauge gauge: gauges) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 Range range = gauge.getRange(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 double lower = range.getA().doubleValue(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 double upper = range.getB().doubleValue(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 for (RangeWithValues rwv: rwvs) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 if (lower <= rwv.getStart() && upper >= rwv.getEnd()) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 compareQsWithGauge(wst, gauge, rwv.getValues()); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 return true; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 /** Form RangeWithValue-Array from state data. */ |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 protected RangeWithValues[] extractInput(StateData data) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 if (data == null) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 return null; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 String dataString = (String) data.getValue(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 String[] ranges = dataString.split(":"); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 List<RangeWithValues> rwv = new ArrayList<RangeWithValues>(); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
219 for (String range: ranges) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
220 String[] parts = range.split(";"); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 double lower = Double.parseDouble(parts[0]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 double upper = Double.parseDouble(parts[1]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 String[] values = parts[2].split(","); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
226 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 int num = values.length; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 double[] res = new double[num]; |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 for (int i = 0; i < num; i++) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
231 try { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
232 res[i] = Double.parseDouble(values[i]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
233 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
234 catch (NumberFormatException nfe) { |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
235 logger.warn(nfe, nfe); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
236 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
237 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 rwv.add(new RangeWithValues(lower, upper, res)); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
240 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
242 return rwv.toArray(new RangeWithValues[rwv.size()]); |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
243 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
244 } |
4ffeccc5b5a1
Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
245 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |