comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightData.java @ 3318:dbe2f85bf160

merged flys-artifacts/2.8
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:35 +0200
parents 4bd3d8bbb60c
children 5fced192b95c
comparison
equal deleted inserted replaced
2987:98c7a46ec5ae 3318:dbe2f85bf160
1 package de.intevation.flys.artifacts.model;
2
3 import java.io.Serializable;
4
5 import gnu.trove.TDoubleArrayList;
6
7 import de.intevation.artifacts.CallContext;
8
9 import de.intevation.flys.artifacts.resources.Resources;
10
11
12 public class MiddleBedHeightData implements Serializable {
13
14 public static final String I18N_SINGLE_NAME = "facet.bedheight_middle.single";
15 public static final String I18N_EPOCH_NAME = "facet.bedheight_middle.epoch";
16
17 private int startYear;
18 private int endYear;
19 private String evaluatedBy;
20 private String description;
21
22 private TDoubleArrayList km;
23 private TDoubleArrayList middleHeight;
24 private TDoubleArrayList uncertainty;
25 private TDoubleArrayList soundingWidth;
26 private TDoubleArrayList dataGap;
27 private TDoubleArrayList width;
28
29
30 protected MiddleBedHeightData(int start, int end, String eval, String desc) {
31 this.startYear = start;
32 this.endYear = end;
33 this.evaluatedBy = eval;
34 this.description = desc;
35
36 this.km = new TDoubleArrayList();
37 this.middleHeight = new TDoubleArrayList();
38 this.uncertainty = new TDoubleArrayList();
39 this.soundingWidth = new TDoubleArrayList();
40 this.dataGap = new TDoubleArrayList();
41 this.width = new TDoubleArrayList();
42 }
43
44
45 public int getStartYear() {
46 return startYear;
47 }
48
49 public int getEndYear() {
50 return endYear;
51 }
52
53 public String getEvaluatedBy() {
54 return evaluatedBy;
55 }
56
57 public String getDescription() {
58 return description;
59 }
60
61
62 public void addKM(double km) {
63 this.km.add(km);
64 }
65
66 public double getKM(int idx) {
67 return km.get(idx);
68 }
69
70 public void addMiddleHeight(double middleHeight) {
71 this.middleHeight.add(middleHeight);
72 }
73
74 public double getMiddleHeight(int idx) {
75 return middleHeight.get(idx);
76 }
77
78 public void addUncertainty(double uncertainty) {
79 this.uncertainty.add(uncertainty);
80 }
81
82 public double getUncertainty(int idx) {
83 return uncertainty.get(idx);
84 }
85
86 public void addSoundingWidth(double soundingWidth) {
87 this.soundingWidth.add(soundingWidth);
88 }
89
90 public double getSoundingWidth(int idx) {
91 return soundingWidth.get(idx);
92 }
93
94 public void addDataGap(double gap) {
95 this.dataGap.add(gap);
96 }
97
98 public double getDataGap(int idx) {
99 return dataGap.get(idx);
100 }
101
102 public void addWidth(double width) {
103 this.width.add(width);
104 }
105
106 public double getWidth(int idx) {
107 return width.get(idx);
108 }
109
110 public int size() {
111 return km.size();
112 }
113
114
115 public double[][] getMiddleHeightsPoints() {
116 double[][] points = new double[2][size()];
117
118 for (int i = 0, n = size(); i < n; i++) {
119 points[0][i] = getKM(i);
120 points[1][i] = getMiddleHeight(i);
121 }
122
123 return points;
124 }
125
126
127 public String getSoundingName(CallContext context) {
128 if (getStartYear() == getEndYear()) {
129 return Resources.getMsg(
130 context.getMeta(),
131 I18N_SINGLE_NAME,
132 I18N_SINGLE_NAME,
133 new Object[] { getStartYear() }
134 );
135 }
136 else {
137 return Resources.getMsg(
138 context.getMeta(),
139 I18N_EPOCH_NAME,
140 I18N_EPOCH_NAME,
141 new Object[] { getStartYear(), getEndYear() }
142 );
143 }
144 }
145 }
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org