Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java @ 8948:a4f1ac81f26d
Work on SINFO-FlowDepthMinMax.
Also rework of result row stuff, in order to reduce abstraction, using result type concept
author | gernotbelger |
---|---|
date | Wed, 14 Mar 2018 14:10:32 +0100 |
parents | 5d5d482da3e9 |
children | b5600453bb8f |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java Wed Mar 14 14:09:33 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java Wed Mar 14 14:10:32 2018 +0100 @@ -14,7 +14,8 @@ import org.apache.commons.lang.math.DoubleRange; import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider; -import org.dive4elements.river.artifacts.sinfo.tkhcalculation.Tkh; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.tkhcalculation.TkhCalculator; import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder; import org.dive4elements.river.artifacts.sinfo.util.WstInfo; @@ -24,7 +25,7 @@ */ final class FlowDepthCalculator { - private final Collection<FlowDepthRow> rows = new ArrayList<>(); + private final Collection<SInfoResultRow> rows = new ArrayList<>(); private final BedHeightsFinder bedHeight; @@ -63,14 +64,21 @@ private void calculateResultRow(final double station) { - final Tkh tkh = this.tkhCalculator.getTkh(station); + final SInfoResultRow row = SInfoResultRow.create(); + + row.putValue(SInfoResultType.waterlevelLabel, this.wstLabel); + row.putValue(SInfoResultType.soundingLabel, this.bedHeightLabel); + + // REMARK: access the gauge once only during calculation + final String gaugeLabel = this.riverInfoProvider.findGauge(station); + row.putValue(SInfoResultType.gaugeLabel, gaugeLabel); // REMARK: access the location once only during calculation final String location = this.riverInfoProvider.getLocation(station); + row.putValue(SInfoResultType.location, location); - // REMARK: access the gauge once only during calculation - final String gaugeLabel = this.riverInfoProvider.findGauge(station); + this.tkhCalculator.calculateTkh(station, row); - this.rows.add(new FlowDepthRow(tkh, this.wstLabel, gaugeLabel, this.bedHeightLabel, location)); + this.rows.add(row); } } \ No newline at end of file