[PATCH] Discharge zone for sinfo collision output without GLQ (Meilenstein 2, 2.1.4)
Wald Commits
scm-commit at wald.intevation.org
Wed Oct 17 16:07:41 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1539785242 -7200
# Node ID 0c114309d2a0243e6a96c7952cd5cfc5ff6c3d58
# Parent 4deb6b24f0723d1433d31bed5f000f8cbe4bd5fb
Discharge zone for sinfo collision output without GLQ (Meilenstein 2, 2.1.4)
diff -r 4deb6b24f072 -r 0c114309d2a0 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java Wed Oct 17 16:00:38 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java Wed Oct 17 16:07:22 2018 +0200
@@ -178,7 +178,7 @@
// Find the gauge and load its main value list, if not already in the map
final String gnKey = gaugeName.toLowerCase();
if (!zoneFinders.containsKey(gnKey))
- zoneFinders.put(gnKey, GaugeMainValueFinder.loadValues(MainValueTypeKey.Q, river, gaugeName, problems));
+ zoneFinders.put(gnKey, GaugeMainValueFinder.loadValues(MainValueTypeKey.Q, river, gaugeName, problems, "GLQ"));
// Build the zone name
if (zoneFinders.get(gnKey) == null)
return "";
diff -r 4deb6b24f072 -r 0c114309d2a0 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeMainValueFinder.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeMainValueFinder.java Wed Oct 17 16:00:38 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeMainValueFinder.java Wed Oct 17 16:07:22 2018 +0200
@@ -50,14 +50,25 @@
/***** CONSTRUCTORS *****/
- private GaugeMainValueFinder(final MainValueTypeKey keyType, final Gauge gauge, final String gaugeName, final Calculation problems) {
+ private GaugeMainValueFinder(final MainValueTypeKey keyType, final Gauge gauge, final String gaugeName, final Calculation problems,
+ final String... excludingNames) {
this.gauge = gauge;
this.problems = problems;
this.keyType = keyType;
this.mainValues = new TreeMap<>();
if (gauge != null) {
- for (final MainValue mainValue : MainValue.getValuesOfGaugeAndType(gauge, keyType))
- this.mainValues.put(Double.valueOf(mainValue.getValue().doubleValue()), mainValue);
+ boolean skip;
+ for (final MainValue mainValue : MainValue.getValuesOfGaugeAndType(gauge, keyType)) {
+ skip = false;
+ for (final String excluding : excludingNames) {
+ if (mainValue.getMainValue().getName().equalsIgnoreCase(excluding)) {
+ skip = true;
+ break;
+ }
+ }
+ if (!skip)
+ this.mainValues.put(Double.valueOf(mainValue.getValue().doubleValue()), mainValue);
+ }
}
if (this.mainValues.isEmpty() && (this.problems != null)) {
this.problems.addProblem("gauge_main_values.missing", gaugeName);
@@ -83,9 +94,10 @@
*
* @return The main values finder of the type and gauge, or null
*/
- public static GaugeMainValueFinder loadValues(final MainValueTypeKey type, final River river, final String gaugeName, final Calculation problems) {
+ public static GaugeMainValueFinder loadValues(final MainValueTypeKey type, final River river, final String gaugeName, final Calculation problems,
+ final String... excludingNames) {
final Gauge gauge = river.determineGaugeByName(gaugeName);
- return new GaugeMainValueFinder(type, gauge, gaugeName, problems);
+ return new GaugeMainValueFinder(type, gauge, gaugeName, problems, excludingNames);
}
/**
More information about the Dive4Elements-commits
mailing list