Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelPairSelectState.java @ 1671:da872168a899
Added code to interpolate double values in a sorted array
flys-artifacts/trunk@2883 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 04 Oct 2011 15:23:31 +0000 |
parents | fc9719cddbc6 |
children | 5f1156d61e9e |
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 |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 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
|
12 |
1663
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
13 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
|
14 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.FLYSArtifact; |
1663
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
16 import de.intevation.flys.artifacts.model.CalculationResult; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
17 import de.intevation.flys.artifacts.model.FacetTypes; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
18 import de.intevation.flys.artifacts.model.WQKms; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
19 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
|
20 |
1663
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
21 import de.intevation.flys.utils.FLYSUtils; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
22 import de.intevation.flys.utils.StringUtil; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
23 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public class WaterlevelPairSelectState |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 extends DefaultState |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 implements FacetTypes |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 { |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 /** 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
|
31 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
|
32 |
1663
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
33 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
34 // TODO fix (state.winfo.waterlevel) |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
35 // 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
|
36 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
|
37 = "state.winfo.w_differences"; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
38 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 public WaterlevelPairSelectState() { |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 } |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
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 /** 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
|
44 @Override |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 protected String getUIProvider() { |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 return "datacage_twin_panel"; |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 } |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
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 @Override |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 public Object computeAdvance( |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 FLYSArtifact artifact, |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 String hash, |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 CallContext context, |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 List<Facet> facets, |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 Object old |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 ) { |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 //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
|
59 return ""; |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 } |
1663
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
61 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
62 |
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 * 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
|
65 */ |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
66 @Override |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
67 protected Element createStaticData( |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
68 ElementCreator creator, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
69 CallContext cc, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
70 String name, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
71 String value, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
72 String type |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
73 ) { |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
74 Element dataElement = creator.create("data"); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
75 creator.addAttr(dataElement, "name", name, true); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
76 creator.addAttr(dataElement, "type", type, true); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
77 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
78 Element itemElement = creator.create("item"); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
79 creator.addAttr(itemElement, "value", value, true); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
80 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
81 String[] labels = getLabels(cc, value); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
82 Object[] obj = new Object[] { labels[0] }; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
83 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
84 // TODO own i18n |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
85 String attrValue = Resources.getMsg( |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
86 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
|
87 //I18N_STATIC_KEY, I18N_STATIC_KEY, obj); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
88 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
89 creator.addAttr(itemElement, "label", attrValue, true); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
90 dataElement.appendChild(itemElement); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
91 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
92 return dataElement; |
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 |
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 // TODO merge implementations with WaterlevelSelectState |
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 * 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
|
99 * from the CalculationResult. |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
100 */ |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
101 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
|
102 String[] recommendations = value.split("#"); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
103 String displayString = ""; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
104 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
105 // 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
|
106 // like "W (Q=1) - W (Q=2)". |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
107 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
|
108 String[] minuendParts = StringUtil |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
109 .unbracket(recommendations[i+0]) |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
110 .split(";"); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
111 String[] subtrahendParts = StringUtil |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
112 .unbracket(recommendations[i+1]) |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
113 .split(";"); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
114 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
115 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
116 FLYSArtifact artifact1 = FLYSUtils.getArtifact(minuendParts[0], cc); |
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 CalculationResult rawData1 = (CalculationResult) artifact1.compute( |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
119 cc, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
120 null, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
121 "state.winfo.waterlevel", |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
122 ComputeType.ADVANCE, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
123 false); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
124 WQKms[] wqkms1 = (WQKms[]) rawData1.getData(); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
125 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
126 int idx1 = -1; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
127 try { |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
128 idx1 = Integer.parseInt(minuendParts[2]); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
129 } |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
130 catch (NumberFormatException nfe) { /* do nothing */ } |
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 FLYSArtifact artifact2 = FLYSUtils.getArtifact(subtrahendParts[0], cc); |
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 CalculationResult rawData2 = (CalculationResult) artifact2.compute( |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
135 cc, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
136 null, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
137 "state.winfo.waterlevel", |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
138 ComputeType.ADVANCE, |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
139 false); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
140 WQKms[] wqkms2 = (WQKms[]) rawData2.getData(); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
141 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
142 int idx2 = -1; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
143 try { |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
144 idx2 = Integer.parseInt(subtrahendParts[2]); |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
145 } |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
146 catch (NumberFormatException nfe) { /* do nothing */ } |
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 displayString += "(" + StringUtil.wWrap(wqkms1[idx1].getName()) |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
149 + " - " + StringUtil.wWrap(wqkms2[idx2].getName()) + ")"; |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
150 } |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
151 |
4fbd43061315
Show proper labels for selected differences.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1624
diff
changeset
|
152 return new String[] { displayString }; |
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 |
1173
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
2490d6ef394e
Extended WDifferences bracnh of WINFO to have calculation in dedicated,
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |