Mercurial > dive4elements > river
changeset 9542:9f20afcb98ba
Merge
author | gernotbelger |
---|---|
date | Wed, 17 Oct 2018 16:30:38 +0200 |
parents | 0c114309d2a0 (diff) 482d76aded80 (current diff) |
children | 3264c2df4f18 |
files | |
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:29:27 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java Wed Oct 17 16:30:38 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:29:27 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/GaugeMainValueFinder.java Wed Oct 17 16:30:38 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); } /**