comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstLine.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstLine.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.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 :

http://dive4elements.wald.intevation.org