comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQCKms.java @ 402:eb22ffe4d74c

Implemented methods to retrieve and compute the data used to create discharge longitudinal sections. flys-artifacts/trunk@1843 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 06 May 2011 14:19:27 +0000
parents
children 913b52064449
comparison
equal deleted inserted replaced
401:34de11dcf355 402:eb22ffe4d74c
1 package de.intevation.flys.artifacts.model;
2
3 import gnu.trove.TDoubleArrayList;
4
5
6 /**
7 * This class represents a pool of data triples that consists of 'W', 'Q' and
8 * 'KM' data with corrected 'W' values computed by a BackJumpCorrector.
9 *
10 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
11 */
12 public class WQCKms extends WQKms {
13
14 protected TDoubleArrayList cw;
15
16
17 public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) {
18 super(kms, qs, ws);
19
20 this.cw = new TDoubleArrayList(cws);
21 }
22
23
24 /**
25 * Adds a new row to this data pool with corrected W.
26 *
27 * @param w a W.
28 * @param q a Q.
29 * @param kms a Kms.
30 * @param cw The corrected W.
31 */
32 public void add(double w, double q, double kms, double cw) {
33 add(w, q, kms);
34 this.cw.add(cw);
35 }
36
37
38 /**
39 * This method returns a 4dim array of W, Q,Kms and corrected W.
40 *
41 * @param idx The position of the triple.
42 * @param dst destination array
43 *
44 * @return a 4dim array of [W, Q, Kms, CW] in dst.
45 */
46 public double[] get(int idx, double[] dst) {
47 dst = super.get(idx, dst);
48
49 if (dst.length < 4) {
50 return dst;
51 }
52
53 if (cw != null && cw.size() > idx) {
54 dst[3] = cw.get(idx);
55 }
56
57 return dst;
58 }
59
60
61 /**
62 * Returns the double array of corrected W values.
63 *
64 * @return the double array of corrected W values.
65 */
66 public double[] getCWs() {
67 return cw.toNativeArray();
68 }
69 }
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org