# HG changeset patch # User gernotbelger # Date 1547053671 -3600 # Node ID aa6ee96071b7b2d367785acee0bca03544451ad1 # Parent 1a7cfeb1ff8926d4ffe252e657aea5265f527a87 Punkt 6.2.1 Sprünge auf vollen HM diff -r 1a7cfeb1ff89 -r aa6ee96071b7 artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationResult.java Wed Jan 09 17:13:25 2019 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationResult.java Wed Jan 09 18:07:51 2019 +0100 @@ -86,14 +86,17 @@ return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; } - protected final List getValues(final IResultType type) { + protected final List getValues(final IResultType type, final Predicate rowFilter) { final List values = new ArrayList<>(); for (final ResultRow row : this.rows) { - @SuppressWarnings("unchecked") - final TYPE value = (TYPE) row.getValue(type); - values.add(value); + + if (rowFilter.evaluate(row)) { + @SuppressWarnings("unchecked") + final TYPE value = (TYPE) row.getValue(type); + values.add(value); + } } return values; diff -r 1a7cfeb1ff89 -r aa6ee96071b7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Wed Jan 09 17:13:25 2019 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Wed Jan 09 18:07:51 2019 +0100 @@ -12,6 +12,7 @@ import java.util.Collection; import java.util.List; +import org.apache.commons.collections.PredicateUtils; import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.sinfo.tkhcalculation.SoilKind; @@ -39,7 +40,7 @@ public final boolean hasTkh() { return this.hasTkh; } - + public boolean isShowRefGauges() { return this.wst.isShowRefGauges(); } @@ -47,7 +48,7 @@ public final double[][] getTkhUpPoints() { final double[][] points = getStationPoints(SInfoResultType.tkhup); - final List kinds = getValues(SInfoResultType.soilkind); + final List kinds = getValues(SInfoResultType.soilkind, PredicateUtils.truePredicate()); final double[] xPoints = points[0]; final double[] yPoints = points[1]; @@ -58,7 +59,7 @@ public final double[][] getTkhDownPoints() { final double[][] points = getStationPoints(SInfoResultType.tkhdown); - final List kinds = getValues(SInfoResultType.soilkind); + final List kinds = getValues(SInfoResultType.soilkind, PredicateUtils.truePredicate()); final double[] xPoints = points[0]; final double[] yPoints = points[1]; diff -r 1a7cfeb1ff89 -r aa6ee96071b7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Wed Jan 09 17:13:25 2019 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationCalculationResult.java Wed Jan 09 18:07:51 2019 +0100 @@ -53,6 +53,16 @@ } } + private final static class HasInfrastructurePredicate implements Predicate { + + @Override + public boolean evaluate(final Object object) { + final ResultRow row = (ResultRow) object; + + return row.getValue(SInfoResultType.riverside) != null; + } + } + private static final long serialVersionUID = 1L; private final boolean isUseWspl; @@ -189,7 +199,10 @@ } public List getValidDurationChartKilometers() { - return getValues(GeneralResultType.station); + + // Wunsch BfG (Testung MS3): nur stationen mit infrastruktur + final Predicate filter = new HasInfrastructurePredicate(); + return getValues(GeneralResultType.station, filter); } @Override