Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java @ 1713:6d9184c745dd
Bugfix: #226 Set the upper bound of duration curve charts to 364.
flys-artifacts/trunk@2985 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 17 Oct 2011 11:04:53 +0000 |
parents | 03fbf1b30e72 |
children | fa932d618989 |
rev | line source |
---|---|
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import gnu.trove.TDoubleArrayList; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 public class WKmsImpl |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 extends NamedObjectImpl |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 implements WKms |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 protected TDoubleArrayList kms; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 protected TDoubleArrayList ws; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 public WKmsImpl() { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 super(""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 kms = new TDoubleArrayList(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 ws = new TDoubleArrayList(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
18 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public WKmsImpl(int capacity) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 super(""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 kms = new TDoubleArrayList(capacity); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 ws = new TDoubleArrayList(capacity); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
25 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public WKmsImpl(TDoubleArrayList kms, TDoubleArrayList ws) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 this(kms, ws, ""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
30 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public WKmsImpl( |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 TDoubleArrayList kms, |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 TDoubleArrayList ws, |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 String name |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 ) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 super(name); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 this.kms = kms; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 this.ws = ws; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
41 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 public void add(double km, double w) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 kms.add(km); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 ws .add(w); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
47 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
48 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 public double getW(int index) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 return ws.getQuick(index); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
53 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
54 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 public double getKm(int index) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 return kms.getQuick(index); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
59 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
60 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 public int size() { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 return kms.size(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 } |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
64 |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
65 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
66 public TDoubleArrayList allKms() { |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
67 return kms; |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
68 } |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
69 |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
70 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
71 public TDoubleArrayList allWs() { |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
72 return ws; |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
73 } |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |