comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java @ 678:19a3185822a4

Added error reporting to 'Wasserspiegellage' calculation. flys-artifacts/trunk@2102 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 10 Jun 2011 15:59:47 +0000
parents 8b0152363bdb
children eab5e5089d77
comparison
equal deleted inserted replaced
677:a95f34f1f39a 678:19a3185822a4
109 this.w.add(w); 109 this.w.add(w);
110 this.q.add(q); 110 this.q.add(q);
111 this.kms.add(kms); 111 this.kms.add(kms);
112 } 112 }
113 113
114
115 public void add(double[] w, double[] q, double[] kms) {
116 this.w.add(w);
117 this.q.add(q);
118 this.kms.add(kms);
119 }
120
121
122 /** 114 /**
123 * Returns the number of triples stored in this data pool. 115 * Returns the number of triples stored in this data pool.
124 * 116 *
125 * @return the number of triples stored in this data pool. 117 * @return the number of triples stored in this data pool.
126 */ 118 */
170 * @return a string that consist of the first and last kilometer. 162 * @return a string that consist of the first and last kilometer.
171 */ 163 */
172 public String toString() { 164 public String toString() {
173 double from = getKms(0); 165 double from = getKms(0);
174 double to = getKms(size()-1); 166 double to = getKms(size()-1);
175 return Double.toString(from) + " - " + Double.toString(to); 167 return from + " - " + to;
176 }
177
178
179 /**
180 * Merges the WQKms objects of an incoming 2dim array (table) where the
181 * objects of a column belong together.
182 *
183 * @param toMerge The objects that need to be merged.
184 *
185 * @return an array of merged WQKms objects.
186 */
187 public static WQKms[] merge(WQKms[][] toMerge) {
188 int num = toMerge[0].length;
189
190 // TODO IS THE LENGTH CORRECT?
191 WQKms[] merged = new WQKms[num];
192 for (int i = 0; i < num; i++) {
193 merged[i] = new WQKms();
194 }
195
196 for (int i = 0; i < toMerge.length; i++) {
197 WQKms[] tmp = toMerge[i];
198
199 for (int j = 0; j < num; j++) {
200 WQKms toAdd = tmp[j];
201 merged[j].add(toAdd.getWs(), toAdd.getQs(), toAdd.getKms());
202 }
203 }
204
205 return merged;
206 } 168 }
207 } 169 }
208 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 170 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org