Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java @ 8854:7bbfb24e6eec
SINFO - first prototype of BArt Fließtiefen
author | gernotbelger |
---|---|
date | Thu, 18 Jan 2018 18:34:41 +0100 |
parents | |
children | 9f7a285b0ee3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Jan 18 18:34:41 2018 +0100 @@ -0,0 +1,68 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.sinfo.flowdepth; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; + +import gnu.trove.TDoubleArrayList; + +/** + * Contains the results of a {@link FlowDepthCalculation}. + * + * @author Gernot Belger + */ +class FlowDepthCalculationResult +implements Serializable { + + private static final long serialVersionUID = 1L; + + private final Collection<FlowDepthRow> rows = new ArrayList<>(); + + private final String wstLabel; + + private final String soundingLabel; + + public FlowDepthCalculationResult(final String wstLabel, final String soundingLabel) { + this.wstLabel = wstLabel; + this.soundingLabel = soundingLabel; + } + + public void addRow(double station, double flowDepth, double flowDepthWithTkh, double tkh, double waterlevel, double discharge, String waterlevelLabel, String gauge, double meanBedHeight, String sondageLabel, String location) { + rows.add(new FlowDepthRow(station, flowDepth, flowDepthWithTkh, tkh, waterlevel, discharge, waterlevelLabel, gauge, meanBedHeight, sondageLabel, location)); + } + + public String getWstLabel() { + return this.wstLabel; + } + + public String getSoundingLabel() { + return this.soundingLabel; + } + + public Collection<FlowDepthRow> getRows() { + return Collections.unmodifiableCollection( rows ); + } + + public double[][] getFlowDepthPoints() { + + TDoubleArrayList xPoints = new TDoubleArrayList(rows.size()); + TDoubleArrayList yPoints = new TDoubleArrayList(rows.size()); + + for (FlowDepthRow row : rows) { + xPoints.add(row.getStation()); + yPoints.add(row.getFlowDepth()); + } + + return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; + } +} \ No newline at end of file