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