8854
|
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 package org.dive4elements.river.artifacts.sinfo.flowdepth; |
|
11 |
|
12 import java.io.Serializable; |
|
13 import java.util.ArrayList; |
|
14 import java.util.Collection; |
|
15 import java.util.Collections; |
|
16 |
|
17 import gnu.trove.TDoubleArrayList; |
|
18 |
|
19 /** |
|
20 * Contains the results of a {@link FlowDepthCalculation}. |
|
21 * |
|
22 * @author Gernot Belger |
|
23 */ |
|
24 class FlowDepthCalculationResult |
|
25 implements Serializable { |
|
26 |
|
27 private static final long serialVersionUID = 1L; |
|
28 |
|
29 private final Collection<FlowDepthRow> rows = new ArrayList<>(); |
|
30 |
|
31 private final String wstLabel; |
|
32 |
|
33 private final String soundingLabel; |
|
34 |
|
35 public FlowDepthCalculationResult(final String wstLabel, final String soundingLabel) { |
|
36 this.wstLabel = wstLabel; |
|
37 this.soundingLabel = soundingLabel; |
|
38 } |
|
39 |
|
40 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) { |
|
41 rows.add(new FlowDepthRow(station, flowDepth, flowDepthWithTkh, tkh, waterlevel, discharge, waterlevelLabel, gauge, meanBedHeight, sondageLabel, location)); |
|
42 } |
|
43 |
|
44 public String getWstLabel() { |
|
45 return this.wstLabel; |
|
46 } |
|
47 |
|
48 public String getSoundingLabel() { |
|
49 return this.soundingLabel; |
|
50 } |
|
51 |
|
52 public Collection<FlowDepthRow> getRows() { |
|
53 return Collections.unmodifiableCollection( rows ); |
|
54 } |
|
55 |
|
56 public double[][] getFlowDepthPoints() { |
|
57 |
|
58 TDoubleArrayList xPoints = new TDoubleArrayList(rows.size()); |
|
59 TDoubleArrayList yPoints = new TDoubleArrayList(rows.size()); |
|
60 |
|
61 for (FlowDepthRow row : rows) { |
|
62 xPoints.add(row.getStation()); |
|
63 yPoints.add(row.getFlowDepth()); |
|
64 } |
|
65 |
|
66 return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; |
|
67 } |
|
68 } |