Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 2422:44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
flys-artifacts/tags/2.6.1@4077 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 11:29:41 +0000 |
parents | 899ca89f497e |
children | ac528b883b47 |
comparison
equal
deleted
inserted
replaced
2421:59047dfed8be | 2422:44dc117aa2b7 |
---|---|
1117 */ | 1117 */ |
1118 public double[] getQs() { | 1118 public double[] getQs() { |
1119 StateData dMode = getData("wq_mode"); | 1119 StateData dMode = getData("wq_mode"); |
1120 StateData dSelection = getData("wq_selection"); | 1120 StateData dSelection = getData("wq_selection"); |
1121 | 1121 |
1122 String mode = dMode != null ? (String) dMode.getValue() : ""; | 1122 boolean isRange = dSelection != null |
1123 String sel = dSelection != null ? (String)dSelection.getValue() : null; | 1123 ? Boolean.valueOf((String)dSelection.getValue()) |
1124 | 1124 : false; |
1125 if (mode.equals("Q")) { | 1125 |
1126 if (sel != null && sel.equals("single")) { | 1126 if (isQ()) { |
1127 if (!isRange) { | |
1127 return getSingleWQValues(); | 1128 return getSingleWQValues(); |
1128 } | 1129 } |
1129 else { | 1130 else { |
1130 return getWQTriple(); | 1131 return getWQTriple(); |
1131 } | 1132 } |
1137 } | 1138 } |
1138 | 1139 |
1139 | 1140 |
1140 public boolean isQ() { | 1141 public boolean isQ() { |
1141 StateData mode = getData("wq_mode"); | 1142 StateData mode = getData("wq_mode"); |
1142 return mode != null && mode.getValue().equals("Q"); | 1143 String value = (mode != null) ? (String) mode.getValue() : null; |
1144 return value != null ? Boolean.valueOf(value) : false; | |
1145 } | |
1146 | |
1147 public boolean isW() { | |
1148 StateData mode = getData("wq_mode"); | |
1149 String value = (mode != null) ? (String) mode.getValue() : null; | |
1150 return value != null ? !Boolean.valueOf(value) : false; | |
1143 } | 1151 } |
1144 | 1152 |
1145 public boolean isFreeW() { | 1153 public boolean isFreeW() { |
1146 StateData mode = getData("wq_mode"); | 1154 if(!isW()) { |
1147 return mode != null && mode.getValue().equals("WFREE"); | 1155 return false; |
1156 } | |
1157 StateData mode = getData("wq_free"); | |
1158 String value = (mode != null) ? (String) mode.getValue() : null; | |
1159 | |
1160 return value != null ? Boolean.valueOf(value) : false; | |
1148 } | 1161 } |
1149 | 1162 |
1150 | 1163 |
1151 /** | 1164 /** |
1152 * Returns true, if the parameter is set to compute data on a free range. | 1165 * Returns true, if the parameter is set to compute data on a free range. |
1155 * | 1168 * |
1156 * @return true, if the calculation should compute on a free range otherwise | 1169 * @return true, if the calculation should compute on a free range otherwise |
1157 * false and the calculation is bound to a gauge. | 1170 * false and the calculation is bound to a gauge. |
1158 */ | 1171 */ |
1159 public boolean isFreeQ() { | 1172 public boolean isFreeQ() { |
1173 if(!isQ()) { | |
1174 return false; | |
1175 } | |
1160 StateData mode = getData("wq_free"); | 1176 StateData mode = getData("wq_free"); |
1161 String value = (mode != null) ? (String) mode.getValue() : null; | 1177 String value = (mode != null) ? (String) mode.getValue() : null; |
1162 | 1178 |
1163 logger.debug("isFreeQ: " + value); | 1179 logger.debug("isFreeQ: " + value); |
1164 | 1180 |
1173 * | 1189 * |
1174 * @return an array of Q values. | 1190 * @return an array of Q values. |
1175 */ | 1191 */ |
1176 public double[] getQs(double[] range) { | 1192 public double[] getQs(double[] range) { |
1177 StateData dMode = getData("wq_mode"); | 1193 StateData dMode = getData("wq_mode"); |
1178 StateData dValues = getData("wq_values"); | 1194 |
1179 | 1195 if (isQ()) { |
1180 String mode = (dMode != null) ? (String) dMode.getValue() : ""; | |
1181 | |
1182 if (mode.equals("Q")) { | |
1183 return getWQForDist(range); | 1196 return getWQForDist(range); |
1184 } | 1197 } |
1185 | 1198 |
1186 logger.warn("You try to get Qs, but Ws has been inserted."); | 1199 logger.warn("You try to get Qs, but Ws has been inserted."); |
1187 return null; | 1200 return null; |
1194 * @param range A 2dim array with lower and upper kilometer range. | 1207 * @param range A 2dim array with lower and upper kilometer range. |
1195 * | 1208 * |
1196 * @return an array of W values. | 1209 * @return an array of W values. |
1197 */ | 1210 */ |
1198 public double[] getWs(double[] range) { | 1211 public double[] getWs(double[] range) { |
1199 StateData dMode = getData("wq_mode"); | 1212 if (isW()) { |
1200 StateData dValues = getData("wq_values"); | |
1201 | |
1202 String mode = (dMode != null) ? (String) dMode.getValue() : ""; | |
1203 | |
1204 if (mode.equals("W")) { | |
1205 return getWQForDist(range); | 1213 return getWQForDist(range); |
1206 } | 1214 } |
1207 | 1215 |
1208 logger.warn("You try to get Ws, but Qs has been inserted."); | 1216 logger.warn("You try to get Ws, but Qs has been inserted."); |
1209 return null; | 1217 return null; |
1214 * This method returns the W values. | 1222 * This method returns the W values. |
1215 * | 1223 * |
1216 * @return the selected W values or null, if no W values are selected. | 1224 * @return the selected W values or null, if no W values are selected. |
1217 */ | 1225 */ |
1218 public double[] getWs() { | 1226 public double[] getWs() { |
1219 StateData dMode = getData("wq_mode"); | |
1220 StateData dSingle = getData("wq_single"); | 1227 StateData dSingle = getData("wq_single"); |
1221 | 1228 |
1222 String mode = (dMode != null) ? (String) dMode.getValue() : ""; | 1229 if (isW()) { |
1223 | |
1224 if (mode.equals("W") || mode.equals("WFREE")) { | |
1225 if (dSingle != null) { | 1230 if (dSingle != null) { |
1226 return getSingleWQValues(); | 1231 return getSingleWQValues(); |
1227 } | 1232 } |
1228 else { | 1233 else { |
1229 return getWQTriple(); | 1234 return getWQTriple(); |
1230 } | 1235 } |
1231 } | 1236 } |
1232 else { | 1237 else { |
1233 logger.warn("You try to get Qs, but W has been inserted."); | 1238 logger.warn("You try to get Ws, but Q has been inserted."); |
1234 return null; | 1239 return null; |
1235 } | 1240 } |
1236 } | 1241 } |
1237 | 1242 |
1238 /** | 1243 /** |