Mercurial > dive4elements > river
changeset 9540:0c114309d2a0
Discharge zone for sinfo collision output without GLQ (Meilenstein 2, 2.1.4)
author | mschaefer |
---|---|
date | Wed, 17 Oct 2018 16:07:22 +0200 |
parents | 4deb6b24f072 |
children | 9f20afcb98ba |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeMainValueFinder.java |
diffstat | 2 files changed, 18 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 "";
--- 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); } /**