Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstLine.java @ 3806:881fcd01e056
merged flys-artifacts/pre2.6-2011-11-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:50 +0200 |
parents | c0bec245f608 |
children |
comparison
equal
deleted
inserted
replaced
3802:e831dc29e572 | 3806:881fcd01e056 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import gnu.trove.TDoubleArrayList; | |
4 | |
5 | |
6 /** | |
7 * A model class that is used to store a line of a WST. | |
8 * | |
9 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
10 */ | |
11 public class WstLine { | |
12 | |
13 /** The kilometer value of the line.*/ | |
14 protected double km; | |
15 | |
16 /** The W values.*/ | |
17 protected TDoubleArrayList ws; | |
18 | |
19 /** The Q values.*/ | |
20 protected TDoubleArrayList qs; | |
21 | |
22 | |
23 /** | |
24 * A constructor that builds a new WstLine for a specific kilometer. | |
25 * | |
26 * @param km The kilometer. | |
27 */ | |
28 public WstLine(double km) { | |
29 this.km = km; | |
30 this.ws = new TDoubleArrayList(); | |
31 this.qs = new TDoubleArrayList(); | |
32 } | |
33 | |
34 | |
35 /** | |
36 * Adds a pair of W/Q to this line. | |
37 * | |
38 * @param w The W value. | |
39 * @param q The Q value. | |
40 */ | |
41 public void add(double w, double q) { | |
42 ws.add(w); | |
43 qs.add(q); | |
44 } | |
45 | |
46 | |
47 /** | |
48 * Returns the kilometer of this line. | |
49 * | |
50 * @return the kilomter of this line. | |
51 */ | |
52 public double getKm() { | |
53 return km; | |
54 } | |
55 | |
56 | |
57 /** | |
58 * Returns the W value at index <i>idx</i> of this line. | |
59 * | |
60 * @param idx The position of the desired W value. | |
61 * | |
62 * @return the W at position <i>idx</i>. | |
63 */ | |
64 public double getW(int idx) { | |
65 return ws.size() > idx ? ws.get(idx) : -1d; | |
66 } | |
67 | |
68 | |
69 /** | |
70 * Returns the Q values of this line. | |
71 * | |
72 * @return the Q values of this line. | |
73 */ | |
74 public double[] getQs() { | |
75 return qs.toNativeArray(); | |
76 } | |
77 | |
78 | |
79 /** | |
80 * Returns the number of columns this line consists of. | |
81 * | |
82 * @return the columns this line consists of. | |
83 */ | |
84 public int getSize() { | |
85 return qs.size(); | |
86 } | |
87 } | |
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |