annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.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 4eea35874943
children 5e38e2924c07
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: 4825
diff changeset
9 package org.dive4elements.river.artifacts.states.extreme;
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
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 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
12 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
13
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 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
15
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 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
17
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
18 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
19 import org.dive4elements.artifacts.CallContext;
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
21 import org.dive4elements.river.artifacts.access.ExtremeAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
22
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
23 import org.dive4elements.artifactdatabase.ProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
24 import org.dive4elements.artifactdatabase.data.StateData;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
25
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
26 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
27
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
28 import org.dive4elements.river.artifacts.model.WstValueTable;
4197
810db532803a Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4116
diff changeset
29 /*
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
30 import org.dive4elements.river.model.Gauge;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
31 import org.dive4elements.river.model.Wst;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
32 import org.dive4elements.river.utils.RiverUtils;
4197
810db532803a Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4116
diff changeset
33 */
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
34 import org.dive4elements.river.artifacts.model.Range;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
35 import org.dive4elements.river.model.River;
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
37 import org.dive4elements.river.artifacts.D4EArtifact;
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
39 import org.dive4elements.river.artifacts.model.RangeWithValues;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
40 import org.dive4elements.river.artifacts.states.DefaultState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4825
diff changeset
41 import org.dive4elements.river.artifacts.model.WstValueTableFactory;
4116
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 /** 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
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 /**
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 * 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
48 * 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
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 */
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 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
52
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
53 /** The log used in this state.*/
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
54 private static Logger log = Logger.getLogger(ExtremeQInput.class);
4116
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
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 /** 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
58 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
59 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60
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 /**
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 * 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
64 * 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
65 * (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
66 * 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
67 * 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
68 *
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 * @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
70 * @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
71 * @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
72 * @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
73 *
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 * @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
75 * 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
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 @Override
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 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
79 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
80 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
81 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
82 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
83 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
84 log.debug("ExtremeQInput.createItems: " + name);
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
86 D4EArtifact flysArtifact = (D4EArtifact) artifact;
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87
6101
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
88 ExtremeAccess access = new ExtremeAccess(flysArtifact);
7261
a56fe3bc6700 Refactoring: Let RiverAccess.getRiver return an River.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
89 River river = access.getRiver();
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 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
91
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 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
93 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
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 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
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 if (num == 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
98 log.warn("Selected distance matches no segments.");
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 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
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 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
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 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
105 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
106 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
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
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 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
110
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 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
112 }
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 /** 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
116 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
117 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
118 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
119 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
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 {
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 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
123 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
124 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
125
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 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
127
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 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
129 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
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 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
132 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
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 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
135 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
136 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
137 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 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
140 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 /**
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 * 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
145 * 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
146 */
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 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
148 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
149 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
150 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
151 {
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 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
153 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
154 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
155 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
156
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 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
158 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
159
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 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
161 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
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 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
164 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
165
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 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
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
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 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
172 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
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
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 /** 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
177 @Override
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 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
179 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
180 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
181 log.debug("ExtremeQInput.validate");
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
183 D4EArtifact flys = (D4EArtifact) artifact;
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
184 log.debug("ExtremeQInput: " + getData(flys, "ranges"));
4116
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 // 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
188 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
189
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 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
191 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
192 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
194 List<Gauge> gauges = RiverUtils.getGauges(flys);
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
195 River river = RiverUtils.getRiver(flys);
4116
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 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
197
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 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
199 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
200 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
201 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
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 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
204 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
205 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
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 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 */
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210
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 true;
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
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 /** 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
216 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
217 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
218 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
219 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 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
222 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
223
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 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
225
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 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
227 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
228
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 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
230 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
231
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232 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
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 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
235 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
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 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
238 try {
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
239 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
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 catch (NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7301
diff changeset
242 log.warn(nfe, nfe);
4116
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
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 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
247 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
249 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
250 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 }
4ffeccc5b5a1 Initial GUI and state for per-segment Q-input for extreme valua analysis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org