annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java @ 367:0960df8358ec

New method WQKms.size() to retrieve the number of elements in the data pool. flys-artifacts/trunk@1775 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 29 Apr 2011 10:01:41 +0000
parents d64339f9f38f
children 5f55047a17e8
rev   line source
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
4
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
5 import gnu.trove.TDoubleArrayList;
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 /**
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 * This class represents a pool of data triples that consists of 'W', 'Q' and
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 * 'KM' data.
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 *
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 */
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 public class WQKms implements Serializable {
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 /** The array that contains the 'W' values.*/
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
17 protected TDoubleArrayList w;
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 /** The array that contains the 'Q' values.*/
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
20 protected TDoubleArrayList q;
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /** The array that contains the 'KMs' values.*/
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
23 protected TDoubleArrayList kms;
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public WQKms() {
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
27 this.w = new TDoubleArrayList();
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
28 this.q = new TDoubleArrayList();
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
29 this.kms = new TDoubleArrayList();
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 }
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 /**
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 * Adds a new row to this data pool.
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 *
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 * @param w a W.
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 * @param q a Q.
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * @param kms a Kms.
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 */
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public void add(double w, double q, double kms) {
365
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
41 this.w.add(w);
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
42 this.q.add(q);
c13ca9d632d6 Introduced GNU Trove to store WQKms values in a more performant data structure.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 361
diff changeset
43 this.kms.add(kms);
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 /**
367
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
48 * Returns the number of triples stored in this data pool.
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 *
367
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
50 * @return the number of triples stored in this data pool.
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 */
367
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
52 public int size() {
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
53 return kms.size();
366
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
54 }
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
55
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
56 /**
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
57 * This method returns a triple of W, Q and Kms in a single 3dim array.
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
58 *
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
59 * @param idx The position of the triple.
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
60 * @param dst destination array
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
61 *
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
62 * @return a triple of [W, Q, Kms] in dst.
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
63 */
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
64 public double[] get(int idx, double [] dst) {
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
65 dst[0] = w .get(idx);
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
66 dst[1] = q .get(idx);
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
67 dst[2] = kms.get(idx);
d64339f9f38f WQKms model: Added a get() method which takes destination array as an argument.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 365
diff changeset
68 return dst;
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
367
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
70
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
71
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
72 public double getKms(int idx) {
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
73 return kms.get(idx);
0960df8358ec New method WQKms.size() to retrieve the number of elements in the data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 366
diff changeset
74 }
361
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 }
3e3ec9613883 Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org