annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingleData.java @ 7899:8333b9b06c98 3.1.3

Return NaN for width if no width exists for the requested station in bedheights data.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 21 May 2014 17:03:02 +0200
parents 1aba75321441
children 856701739443
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4533
diff changeset
9 package org.dive4elements.river.artifacts.model.minfo;
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
11 import gnu.trove.TDoubleArrayList;
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
12
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13
7391
9513d1af7d58 Renamed artifacts/**/BedHeight(Single) to BedHeight(Single)Data, to resolve
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6149
diff changeset
14 public class BedHeightSingleData
9513d1af7d58 Renamed artifacts/**/BedHeight(Single) to BedHeight(Single)Data, to resolve
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6149
diff changeset
15 extends BedHeightData
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 {
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 protected int year;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
18 protected TDoubleArrayList data_gap;
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
19 protected TDoubleArrayList soundingWidth;
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
20 protected TDoubleArrayList width;
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
7391
9513d1af7d58 Renamed artifacts/**/BedHeight(Single) to BedHeight(Single)Data, to resolve
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6149
diff changeset
22 public BedHeightSingleData() {
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 super();
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 this.year = -1;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
25 data_gap = new TDoubleArrayList();
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
26 soundingWidth = new TDoubleArrayList();
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
27 width = new TDoubleArrayList();
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 }
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29
7391
9513d1af7d58 Renamed artifacts/**/BedHeight(Single) to BedHeight(Single)Data, to resolve
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6149
diff changeset
30 public BedHeightSingleData(String name) {
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 super(name);
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 this.year = -1;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
33 data_gap = new TDoubleArrayList();
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
34 soundingWidth = new TDoubleArrayList();
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
35 width = new TDoubleArrayList();
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 }
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 public void add(
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 double value,
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 double station,
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 double gap,
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
42 double sounding,
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 double width,
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 int year
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 ) {
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
46 super.add(value, station);
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 this.year = year;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
48 this.data_gap.add(gap);
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
49 this.soundingWidth.add(sounding);
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
50 this.width.add(width);
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 }
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 public int getYear() {
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 return this.year;
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
56
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
57 public double getSoundingWidth(int idx) {
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
58 return this.soundingWidth.getQuick(idx);
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
59 }
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
60
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
61 public double getDataGap(int idx) {
6149
3c8147ba35a6 Bed height: Removed braindead index determination code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
62 return this.data_gap.getQuick(idx);
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
63 }
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
64
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
65 public double getSoundingWidth(double station) {
6149
3c8147ba35a6 Bed height: Removed braindead index determination code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
66 int index = this.station.indexOf(station);
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
67 return index >= 0 ? soundingWidth.getQuick(index): Double.NaN;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
68 }
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
69
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
70 public double getDataGap(double station) {
6149
3c8147ba35a6 Bed height: Removed braindead index determination code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
71 int index = this.station.indexOf(station);
3c8147ba35a6 Bed height: Removed braindead index determination code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
72 return index >= 0 ? data_gap.getQuick(index) : Double.NaN;
3897
bce2dd4310a6 MINFO: Updated data fields to fit the needs of bedheight difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3886
diff changeset
73 }
4533
0a0ab6909cd8 Add method to get all morph width of a BedHeigthSingle object
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3897
diff changeset
74
7828
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
75 public double[] getSoundingWidths() {
8faa8cfd2385 Renamed the incorrectly named morph width to sounding width.
Raimund Renkert <rrenkert@intevation.de>
parents: 7391
diff changeset
76 return this.soundingWidth.toNativeArray();
4533
0a0ab6909cd8 Add method to get all morph width of a BedHeigthSingle object
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3897
diff changeset
77 }
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
78
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
79 public double getWidth(int ndx) {
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
80 return width.getQuick(ndx);
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
81 }
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
82
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
83 public double getWidth(double station) {
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
84 int ndx = this.station.indexOf(station);
7899
8333b9b06c98 Return NaN for width if no width exists for the requested station in bedheights data.
Raimund Renkert <rrenkert@intevation.de>
parents: 7829
diff changeset
85 if (ndx < 0) {
8333b9b06c98 Return NaN for width if no width exists for the requested station in bedheights data.
Raimund Renkert <rrenkert@intevation.de>
parents: 7829
diff changeset
86 return Double.NaN;
8333b9b06c98 Return NaN for width if no width exists for the requested station in bedheights data.
Raimund Renkert <rrenkert@intevation.de>
parents: 7829
diff changeset
87 }
7829
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
88 return width.get(ndx);
1aba75321441 Added morph. active width to bed height difference calculation.
Raimund Renkert <rrenkert@intevation.de>
parents: 7828
diff changeset
89 }
3886
633fbb61a0cc Split bed heights into bed height epochs and single bed heights.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }

http://dive4elements.wald.intevation.org