comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.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 03fbf1b30e72
children b2ea89a665bc
comparison
equal deleted inserted replaced
2181:38207b820dca 2182:5ff481ab24a1
36 this(capacity, ""); 36 this(capacity, "");
37 } 37 }
38 38
39 39
40 public WQKms(int capacity, String name) { 40 public WQKms(int capacity, String name) {
41 super(name); 41 super(capacity, name);
42 this.kms = new TDoubleArrayList(capacity); 42 this.kms = new TDoubleArrayList(capacity);
43 } 43 }
44 44
45 public WQKms(double [] kms, double [] qs, double [] ws) { 45 public WQKms(double [] kms, double [] qs, double [] ws) {
46 this(kms, qs, ws, ""); 46 this(kms, qs, ws, "");
52 this.kms = new TDoubleArrayList(kms); 52 this.kms = new TDoubleArrayList(kms);
53 } 53 }
54 54
55 @Override 55 @Override
56 public void removeNaNs() { 56 public void removeNaNs() {
57 removeNaNs(new TDoubleArrayList [] { w, q, kms }); 57 removeNaNs(new TDoubleArrayList [] { ws, qs, kms });
58 } 58 }
59 59
60 /** 60 /**
61 * Adds a new row to this data pool. 61 * Adds a new row to this data pool.
62 * 62 *
67 public void add(double w, double q, double km) { 67 public void add(double w, double q, double km) {
68 super.add(w, q); 68 super.add(w, q);
69 kms.add(km); 69 kms.add(km);
70 } 70 }
71 71
72 @Override
73 public double [] get(int idx) {
74 return get(idx, new double [3]);
75 }
76
72 /** 77 /**
73 * This method returns a triple of W, Q and Kms in a single 3dim array. 78 * This method returns a triple of W, Q and Kms in a single 3dim array.
74 * 79 *
75 * @param idx The position of the triple. 80 * @param idx The position of the triple.
76 * @param dst destination array 81 * @param dst destination array
77 * 82 *
78 * @return a triple of [W, Q, Kms] in dst. 83 * @return a triple of [W, Q, Kms] in dst.
79 */ 84 */
80 @Override 85 @Override
81 public double[] get(int idx, double [] dst) { 86 public double [] get(int idx, double [] dst) {
82 dst[0] = w .getQuick(idx); 87 dst[0] = ws .getQuick(idx);
83 dst[1] = q .getQuick(idx); 88 dst[1] = qs .getQuick(idx);
84 dst[2] = kms.getQuick(idx); 89 dst[2] = kms.getQuick(idx);
85 return dst; 90 return dst;
86 } 91 }
87 92
88 @Override 93 @Override
95 return kms; 100 return kms;
96 } 101 }
97 102
98 @Override 103 @Override
99 public TDoubleArrayList allWs() { 104 public TDoubleArrayList allWs() {
100 return w; 105 return ws;
101 } 106 }
102 107
103 public double[] getKms() { 108 public double[] getKms() {
104 return kms.toNativeArray(); 109 return kms.toNativeArray();
105 } 110 }

http://dive4elements.wald.intevation.org