comparison flys-backend/src/main/java/de/intevation/flys/model/River.java @ 2373:056b3a5aa181

Removed "NOT NULL" constraint from gauges.range_id because there are gauges which dont have a Gueltigkeitsbereich. flys-backend/trunk@3564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 02 Jan 2012 13:42:27 +0000
parents 0acf28a3d28a
children 6605dcd6745f
comparison
equal deleted inserted replaced
2372:027736510a30 2373:056b3a5aa181
229 * distance. 229 * distance.
230 * 230 *
231 * @return the min and max distance of this river. 231 * @return the min and max distance of this river.
232 */ 232 */
233 public double[] determineMinMaxDistance() { 233 public double[] determineMinMaxDistance() {
234 if (gauges == null) { 234 List<Gauge> gauges = getGauges();
235
236 if (gauges == null || gauges.isEmpty()) {
235 return null; 237 return null;
236 } 238 }
237 239
238 double minmax[] = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; 240 double minmax[] = new double[] { Double.MAX_VALUE, Double.MIN_VALUE };
239 241
240 for (Gauge g: gauges) { 242 for (Gauge g: gauges) {
241 Range r = g.getRange(); 243 Range r = g.getRange();
244
245 if (r == null) {
246 continue;
247 }
242 248
243 double a = r.getA().doubleValue(); 249 double a = r.getA().doubleValue();
244 minmax[0] = minmax[0] < a ? minmax[0] : a; 250 minmax[0] = minmax[0] < a ? minmax[0] : a;
245 251
246 BigDecimal bigB = r.getB(); 252 BigDecimal bigB = r.getB();

http://dive4elements.wald.intevation.org