Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQCKms.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQCKms.java@bcf25d8c183e |
children |
comparison
equal
deleted
inserted
replaced
5830:160f53ee0870 | 5831:bd047b71ab37 |
---|---|
1 package org.dive4elements.river.artifacts.model; | |
2 | |
3 import org.dive4elements.river.utils.DoubleUtil; | |
4 | |
5 import gnu.trove.TDoubleArrayList; | |
6 | |
7 /** | |
8 * This class represents a pool of data triples that consists of 'W', 'Q' and | |
9 * 'KM' data with corrected 'W' values computed by a BackJumpCorrector. | |
10 * | |
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
12 */ | |
13 public class WQCKms | |
14 extends WQKms | |
15 { | |
16 protected TDoubleArrayList cws; | |
17 | |
18 public WQCKms() { | |
19 } | |
20 | |
21 public WQCKms(WQKms other, double [] cws) { | |
22 this.ws = other.ws; | |
23 this.qs = other.qs; | |
24 this.kms = other.kms; | |
25 this.cws = new TDoubleArrayList(cws); | |
26 } | |
27 | |
28 | |
29 public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) { | |
30 super(kms, qs, ws); | |
31 | |
32 this.cws = new TDoubleArrayList(cws); | |
33 } | |
34 | |
35 @Override | |
36 public void removeNaNs() { | |
37 DoubleUtil.removeNaNs(new TDoubleArrayList [] { ws, qs, cws, kms }); | |
38 } | |
39 | |
40 /** | |
41 * Adds a new row to this data pool with corrected W. | |
42 * | |
43 * @param w a W. | |
44 * @param q a Q. | |
45 * @param kms a Kms. | |
46 * @param cw The corrected W. | |
47 */ | |
48 public void add(double w, double q, double kms, double cw) { | |
49 super.add(w, q, kms); | |
50 cws.add(cw); | |
51 } | |
52 | |
53 @Override | |
54 public double[] get(int idx) { | |
55 return get(idx, new double[4]); | |
56 } | |
57 | |
58 /** | |
59 * This method returns a 4dim array of W, Q,Kms and corrected W. | |
60 * | |
61 * @param idx The position of the triple. | |
62 * @param dst destination array | |
63 * | |
64 * @return a 4dim array of [W, Q, Kms, CW] in dst. | |
65 */ | |
66 @Override | |
67 public double[] get(int idx, double[] dst) { | |
68 dst = super.get(idx, dst); | |
69 | |
70 if (dst.length < 4) { | |
71 return dst; | |
72 } | |
73 | |
74 if (cws != null && cws.size() > idx) { | |
75 dst[3] = cws.getQuick(idx); | |
76 } | |
77 | |
78 return dst; | |
79 } | |
80 | |
81 public double getC(int idx) { | |
82 return cws.getQuick(idx); | |
83 } | |
84 | |
85 | |
86 /** | |
87 * Returns the double array of corrected W values. | |
88 * | |
89 * @return the double array of corrected W values. | |
90 */ | |
91 public double[] getCWs() { | |
92 return cws.toNativeArray(); | |
93 } | |
94 } | |
95 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |