Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQCKms.java @ 1190:f514894ec2fd
merged flys-artifacts/2.5
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:17 +0200 |
parents | 035c0095b427 |
children | 5ff481ab24a1 |
comparison
equal
deleted
inserted
replaced
917:b48c36076e17 | 1190:f514894ec2fd |
---|---|
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 public WQCKms() { | |
17 } | |
18 | |
19 public WQCKms(WQKms other, double [] cws) { | |
20 this.w = other.w; | |
21 this.q = other.q; | |
22 this.kms = other.kms; | |
23 this.cw = new TDoubleArrayList(cws); | |
24 } | |
25 | |
26 | |
27 public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) { | |
28 super(kms, qs, ws); | |
29 | |
30 this.cw = new TDoubleArrayList(cws); | |
31 } | |
32 | |
33 @Override | |
34 public void removeNaNs() { | |
35 removeNaNs(new TDoubleArrayList [] { w, q, cw, kms }); | |
36 } | |
37 | |
38 | |
39 /** | |
40 * Adds a new row to this data pool with corrected W. | |
41 * | |
42 * @param w a W. | |
43 * @param q a Q. | |
44 * @param kms a Kms. | |
45 * @param cw The corrected W. | |
46 */ | |
47 public void add(double w, double q, double kms, double cw) { | |
48 add(w, q, kms); | |
49 this.cw.add(cw); | |
50 } | |
51 | |
52 | |
53 /** | |
54 * This method returns a 4dim array of W, Q,Kms and corrected W. | |
55 * | |
56 * @param idx The position of the triple. | |
57 * @param dst destination array | |
58 * | |
59 * @return a 4dim array of [W, Q, Kms, CW] in dst. | |
60 */ | |
61 @Override | |
62 public double[] get(int idx, double[] dst) { | |
63 dst = super.get(idx, dst); | |
64 | |
65 if (dst.length < 4) { | |
66 return dst; | |
67 } | |
68 | |
69 if (cw != null && cw.size() > idx) { | |
70 dst[3] = cw.getQuick(idx); | |
71 } | |
72 | |
73 return dst; | |
74 } | |
75 | |
76 public double getC(int idx) { | |
77 return cw.getQuick(idx); | |
78 } | |
79 | |
80 | |
81 /** | |
82 * Returns the double array of corrected W values. | |
83 * | |
84 * @return the double array of corrected W values. | |
85 */ | |
86 public double[] getCWs() { | |
87 return cw.toNativeArray(); | |
88 } | |
89 } | |
90 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |