comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightData.java @ 8558:d0ea092a32f5

Remove obsolete class hierarchy for bed height data.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 10:12:12 +0100
parents 9513d1af7d58
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8557:29ab66ce06aa 8558:d0ea092a32f5
18 { 18 {
19 private static Logger log = Logger.getLogger(BedHeightData.class); 19 private static Logger log = Logger.getLogger(BedHeightData.class);
20 20
21 protected TDoubleArrayList heights; 21 protected TDoubleArrayList heights;
22 protected TDoubleArrayList station; 22 protected TDoubleArrayList station;
23 protected TDoubleArrayList data_gap;
24 protected TDoubleArrayList soundingWidth;
25 protected Integer year;
23 26
24 public BedHeightData() { 27 public BedHeightData() {
25 heights = new TDoubleArrayList(); 28 heights = new TDoubleArrayList();
26 station = new TDoubleArrayList(); 29 station = new TDoubleArrayList();
30 data_gap = new TDoubleArrayList();
31 soundingWidth = new TDoubleArrayList();
27 } 32 }
28 33
29 public BedHeightData(String name) { 34 public BedHeightData(String name) {
30 super(name); 35 super(name);
31 heights = new TDoubleArrayList(); 36 heights = new TDoubleArrayList();
32 station = new TDoubleArrayList(); 37 station = new TDoubleArrayList();
38 data_gap = new TDoubleArrayList();
39 soundingWidth = new TDoubleArrayList();
33 } 40 }
34 41
35 public BedHeightData(int capacity) { 42 public BedHeightData(int capacity) {
36 this(capacity, ""); 43 this(capacity, "");
37 } 44 }
40 super(name); 47 super(name);
41 heights = new TDoubleArrayList(capacity); 48 heights = new TDoubleArrayList(capacity);
42 station = new TDoubleArrayList(capacity); 49 station = new TDoubleArrayList(capacity);
43 } 50 }
44 51
45 public void add(double value, double station) { 52 public void add(
53 double value,
54 double station,
55 double gap,
56 double sounding,
57 Integer year
58 ) {
46 this.heights.add(value); 59 this.heights.add(value);
47 this.station.add(station); 60 this.station.add(station);
61 if (year != null) {
62 this.year = year;
63 }
64 this.data_gap.add(gap);
65 this.soundingWidth.add(sounding);
48 } 66 }
49 67
50 public int size() { 68 public int size() {
51 return heights.size(); 69 return heights.size();
52 } 70 }
80 public double getHeight(double station) { 98 public double getHeight(double station) {
81 int index = this.station.indexOf(station); 99 int index = this.station.indexOf(station);
82 return index >= 0 ? heights.getQuick(index) : Double.NaN; 100 return index >= 0 ? heights.getQuick(index) : Double.NaN;
83 } 101 }
84 102
103 public Integer getYear() {
104 return this.year;
105 }
106
107 public double getSoundingWidth(int idx) {
108 return this.soundingWidth.getQuick(idx);
109 }
110
111 public double getDataGap(int idx) {
112 return this.data_gap.getQuick(idx);
113 }
114
115 public double getSoundingWidth(double station) {
116 int index = this.station.indexOf(station);
117 return index >= 0 ? soundingWidth.getQuick(index): Double.NaN;
118 }
119
120 public double getDataGap(double station) {
121 int index = this.station.indexOf(station);
122 return index >= 0 ? data_gap.getQuick(index) : Double.NaN;
123 }
124
125 public double[] getSoundingWidths() {
126 return this.soundingWidth.toNativeArray();
127 }
128
85 129
86 public static void removeNaNs(TDoubleArrayList [] arrays) { 130 public static void removeNaNs(TDoubleArrayList [] arrays) {
87 131
88 int dest = 0; 132 int dest = 0;
89 133

http://dive4elements.wald.intevation.org