annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java @ 1666:09c1292cf36d

Bugfix: #351 Modified determination of single values specified by min/max values and an interval. flys-artifacts/trunk@2874 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 30 Sep 2011 14:29:26 +0000
parents 4fbd43061315
children fc9719cddbc6
rev   line source
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.List;
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
7 import org.w3c.dom.Element;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
8
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.artifacts.CallContext;
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
11 import de.intevation.artifactdatabase.data.DefaultStateData;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
12 import de.intevation.artifactdatabase.data.StateData;
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.artifactdatabase.state.Facet;
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
15 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
16
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.artifacts.FLYSArtifact;
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
18 import de.intevation.flys.artifacts.model.CalculationResult;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
19 import de.intevation.flys.artifacts.model.FacetTypes;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
20 import de.intevation.flys.artifacts.model.WQKms;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
21 import de.intevation.flys.artifacts.resources.Resources;
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
23 import de.intevation.flys.utils.FLYSUtils;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
24 import de.intevation.flys.utils.StringUtil;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
25
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 public class WaterlevelPairSelectState
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 extends DefaultState
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 implements FacetTypes
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 {
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /** The logger that is used in this state. */
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 private static Logger logger = Logger.getLogger(WaterlevelPairSelectState.class);
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
35
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
36 // TODO fix (state.winfo.waterlevel)
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
37 // own id is state.winfo.waterlevel_pair_select
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
38 public static final String WINFO_WDIFFERENCES_STATE_ID
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
39 = "state.winfo.w_differences";
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
40
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 public WaterlevelPairSelectState() {
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 }
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 /** Specify to display a datacage_twin_panel. */
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 @Override
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 protected String getUIProvider() {
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 return "datacage_twin_panel";
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 }
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 @Override
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 public Object computeAdvance(
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 FLYSArtifact artifact,
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 String hash,
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 CallContext context,
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 List<Facet> facets,
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 Object old
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 ) {
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 //Get data and do stuff, do not calculate
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 return "";
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 }
1663
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
63
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
64
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
65 /**
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
66 * Creats the data element used for the static part of DESCRIBE document.
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
67 */
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
68 @Override
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
69 protected Element createStaticData(
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
70 ElementCreator creator,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
71 CallContext cc,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
72 String name,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
73 String value,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
74 String type
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
75 ) {
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
76 Element dataElement = creator.create("data");
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
77 creator.addAttr(dataElement, "name", name, true);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
78 creator.addAttr(dataElement, "type", type, true);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
79
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
80 Element itemElement = creator.create("item");
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
81 creator.addAttr(itemElement, "value", value, true);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
82
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
83 String[] labels = getLabels(cc, value);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
84 Object[] obj = new Object[] { labels[0] };
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
85
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
86 // TODO own i18n
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
87 String attrValue = Resources.getMsg(
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
88 cc.getMeta(), "wsp.selected.string", "wsp.selected.string", obj);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
89 //I18N_STATIC_KEY, I18N_STATIC_KEY, obj);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
90
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
91 creator.addAttr(itemElement, "label", attrValue, true);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
92 dataElement.appendChild(itemElement);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
93
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
94 return dataElement;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
95 }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
96
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
97
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
98 // TODO merge implementations with WaterlevelSelectState
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
99 /**
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
100 * Get name to display for selected watelerlevels (for example "Q=123")
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
101 * from the CalculationResult.
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
102 */
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
103 public static String[] getLabels(CallContext cc, String value) {
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
104 String[] recommendations = value.split("#");
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
105 String displayString = "";
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
106
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
107 // Walk over all selected recommendations and create label
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
108 // like "W (Q=1) - W (Q=2)".
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
109 for (int i = 0; i < recommendations.length; i+=2) {
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
110 String[] minuendParts = StringUtil
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
111 .unbracket(recommendations[i+0])
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
112 .split(";");
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
113 String[] subtrahendParts = StringUtil
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
114 .unbracket(recommendations[i+1])
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
115 .split(";");
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
116
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
117
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
118 FLYSArtifact artifact1 = FLYSUtils.getArtifact(minuendParts[0], cc);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
119
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
120 CalculationResult rawData1 = (CalculationResult) artifact1.compute(
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
121 cc,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
122 null,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
123 "state.winfo.waterlevel",
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
124 ComputeType.ADVANCE,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
125 false);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
126 WQKms[] wqkms1 = (WQKms[]) rawData1.getData();
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
127
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
128 int idx1 = -1;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
129 try {
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
130 idx1 = Integer.parseInt(minuendParts[2]);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
131 }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
132 catch (NumberFormatException nfe) { /* do nothing */ }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
133
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
134 FLYSArtifact artifact2 = FLYSUtils.getArtifact(subtrahendParts[0], cc);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
135
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
136 CalculationResult rawData2 = (CalculationResult) artifact2.compute(
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
137 cc,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
138 null,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
139 "state.winfo.waterlevel",
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
140 ComputeType.ADVANCE,
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
141 false);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
142 WQKms[] wqkms2 = (WQKms[]) rawData2.getData();
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
143
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
144 int idx2 = -1;
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
145 try {
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
146 idx2 = Integer.parseInt(subtrahendParts[2]);
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
147 }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
148 catch (NumberFormatException nfe) { /* do nothing */ }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
149
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
150 displayString += "(" + StringUtil.wWrap(wqkms1[idx1].getName())
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
151 + " - " + StringUtil.wWrap(wqkms2[idx2].getName()) + ")";
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
152 }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
153
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
154 return new String[] { displayString };
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
155 }
4fbd43061315 Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1624
diff changeset
156
1173
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 }
2490d6ef394e Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org