[PATCH] minor bugfixes

Wald Commits scm-commit at wald.intevation.org
Tue Jul 10 18:53:14 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1531241584 -7200
# Node ID cbe393451ab038c8f42e0c99bb31147d4aad710d
# Parent  54173301bc340cbba3e1fa738c0052f14dfb4283
minor bugfixes

diff -r 54173301bc34 -r cbe393451ab0 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java	Tue Jul 10 14:47:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixZone.java	Tue Jul 10 18:53:04 2018 +0200
@@ -109,10 +109,12 @@
         treeList.addAll(list);
         double lowerCompare = lower + DELTA;
         for (final SalixZone zone : treeList) {
-            if (zone.getLowerFromTo() > lowerCompare) {
-                return true;
+            if ((zone.getUpperFromTo() - zone.getLowerFromTo()) > DELTA) {
+                if (zone.getLowerFromTo() > lowerCompare) {
+                    return true;
+                }
+                lowerCompare = zone.getUpperFromTo() + DELTA;
             }
-            lowerCompare = zone.getUpperFromTo() + DELTA;
         }
         if ((lowerCompare + DELTA) < upper)
             return true; // am Ende nicht geschlossen
@@ -148,6 +150,9 @@
     @Override
     public int compareTo(final SalixZone o) {
         final int basicCompare = this.getLowerFromTo().compareTo(o.getLowerFromTo());
+        if (basicCompare == 0) {
+            return 1; // necessary for the treeSet!
+        }
         return basicCompare;
     }
 
diff -r 54173301bc34 -r cbe393451ab0 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Tue Jul 10 14:47:10 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties	Tue Jul 10 18:53:04 2018 +0200
@@ -1089,6 +1089,8 @@
 mainvalue.duration = \u00dcberflutungsdauer
 mainvalue.duration.description = \u00dcberflutungsdauer ({0})
 uinfo.salix.soundings= Soundings
+uinfo.export.salix_line.csv.header.scenario_dwspl = \u0394MW [cm]
+uinfo.export.salix_line.csv.header.scenario = Salix-Linie_Szenario [m]
 uinfo.export.salix_line.csv.header.salix_line = Salix-Linie [m]
 uinfo.export.salix_line.csv.header.delta_mw =  (MW-MNW)x(-1) [m]
 uinfo.export.salix_line.csv.header.scen =  Salix-Linie [m] Szenario dMW={0} cm
diff -r 54173301bc34 -r cbe393451ab0 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Tue Jul 10 14:47:10 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Tue Jul 10 18:53:04 2018 +0200
@@ -1089,6 +1089,8 @@
 mainvalue.duration = \u00dcberflutungsdauer
 mainvalue.duration.description = \u00dcberflutungsdauer ({0})
 uinfo.salix.soundings= Peilungen
+uinfo.export.salix_line.csv.header.scenario_dwspl = \u0394MW [cm]
+uinfo.export.salix_line.csv.header.scenario = Salix-Linie_Szenario [m]
 uinfo.export.salix_line.csv.header.salix_line = Salix-Linie [m]
 uinfo.export.salix_line.csv.header.delta_mw =  (MW-MNW)x(-1) [m]
 uinfo.export.salix_line.csv.header.scen =  Salix-Linie [m] Szenario dMW={0} cm
diff -r 54173301bc34 -r cbe393451ab0 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java	Tue Jul 10 14:47:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java	Tue Jul 10 18:53:04 2018 +0200
@@ -226,20 +226,23 @@
 
         switch (this.type) {
         case multi:
-
-            final String[] sValues = sValue.trim().split(" ");
-            for (final String value : sValues) {
-                errors.addAll(this.validateSingleInput(value));
+            if (sValue != null) {
+                final String[] sValues = sValue.trim().split(" ");
+                for (final String value : sValues) {
+                    errors.addAll(this.validateSingleInput(value));
+                }
             }
             break;
         case limit5:
-            final String[] values = sValue.trim().split(" ");
-            if (values.length > 5) {
-                errors.add(this.MSG.error_limit_exceeded_salix());// TODO generalize if needed
-            }
-            for (int i = 0; i < values.length; i++) {
-                if (i < 5)
-                    errors.addAll(this.validateNumber(values[i]));
+            if (sValue != null) {
+                final String[] values = sValue.trim().split(" ");
+                if (values.length > 5) {
+                    errors.add(this.MSG.error_limit_exceeded_salix());// TODO generalize if needed
+                }
+                for (int i = 0; i < values.length; i++) {
+                    if (i < 5)
+                        errors.addAll(this.validateNumber(values[i]));
+                }
             }
             break;
         case single:
diff -r 54173301bc34 -r cbe393451ab0 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java	Tue Jul 10 14:47:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java	Tue Jul 10 18:53:04 2018 +0200
@@ -110,10 +110,12 @@
         treeList.addAll(list);
         double lowerCompare = lower + DELTA;
         for (final SalixZone zone : treeList) {
-            if (zone.getLowerFromTo() > lowerCompare) {
-                return true;
+            if ((zone.getUpperFromTo() - zone.getLowerFromTo()) > DELTA) {
+                if (zone.getLowerFromTo() > lowerCompare) {
+                    return true;
+                }
+                lowerCompare = zone.getUpperFromTo() + DELTA;
             }
-            lowerCompare = zone.getUpperFromTo() + DELTA;
         }
         if ((lowerCompare + DELTA) < upper)
             return true; // am Ende nicht geschlossen
@@ -149,6 +151,9 @@
     @Override
     public int compareTo(final SalixZone o) {
         final int basicCompare = this.getLowerFromTo().compareTo(o.getLowerFromTo());
+        if (basicCompare == 0) {
+            return 1; // necessary for the treeSet!
+        }
         return basicCompare;
     }
 


More information about the Dive4Elements-commits mailing list