comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java @ 361:3e3ec9613883

Introduced a model class to store a set of triple data objects that consist of W, Q and Kms information. flys-artifacts/trunk@1769 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 29 Apr 2011 07:27:05 +0000
parents
children c13ca9d632d6
comparison
equal deleted inserted replaced
360:3571357c85a7 361:3e3ec9613883
1 package de.intevation.flys.artifacts.model;
2
3 import java.io.Serializable;
4 import java.util.ArrayList;
5 import java.util.List;
6
7
8 /**
9 * This class represents a pool of data triples that consists of 'W', 'Q' and
10 * 'KM' data.
11 *
12 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
13 */
14 public class WQKms implements Serializable {
15
16 /** The array that contains the 'W' values.*/
17 protected List<Double> w;
18
19 /** The array that contains the 'Q' values.*/
20 protected List<Double> q;
21
22 /** The array that contains the 'KMs' values.*/
23 protected List<Double> kms;
24
25
26 public WQKms() {
27 this.w = new ArrayList<Double>();
28 this.q = new ArrayList<Double>();
29 this.kms = new ArrayList<Double>();
30 }
31
32
33 /**
34 * Adds a new row to this data pool.
35 *
36 * @param w a W.
37 * @param q a Q.
38 * @param kms a Kms.
39 */
40 public void add(double w, double q, double kms) {
41 this.w.add(new Double(w));
42 this.q.add(new Double(q));
43 this.kms.add(new Double(kms));
44 }
45
46
47 /**
48 * This method returns a triple of W, Q and Kms in a single 3dim array.
49 *
50 * @param idx The position of the triple.
51 *
52 * @return a triple of [W, Q, Kms].
53 */
54 public double[] get(int idx) {
55 return new double[] { w.get(idx), q.get(idx), kms.get(idx) };
56 }
57 }
58 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org