Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsImpl.java @ 7296:16e34277bba4
doc fix.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 11 Oct 2013 12:40:52 +0200 |
parents | 3c4efd4b2c19 |
children | 1cff4c98df76 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2422
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 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
|
12 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2422
diff
changeset
|
13 import org.dive4elements.river.utils.DataUtil; |
2420
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
14 |
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
15 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 public class WKmsImpl |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 extends NamedObjectImpl |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 implements WKms |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 protected TDoubleArrayList kms; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 protected TDoubleArrayList ws; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public WKmsImpl() { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 super(""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 kms = new TDoubleArrayList(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 ws = new TDoubleArrayList(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
29 |
1720
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
30 /** |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
31 * Create named, empty WKms. |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
32 */ |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
33 public WKmsImpl(String name) { |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
34 super(name); |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
35 kms = new TDoubleArrayList(); |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
36 ws = new TDoubleArrayList(); |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
37 } |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
38 |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
39 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 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
|
41 super(""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 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
|
43 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
|
44 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
46 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 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
|
48 this(kms, ws, ""); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
51 |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public WKmsImpl( |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 TDoubleArrayList kms, |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 TDoubleArrayList ws, |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 String name |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 ) { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 super(name); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 this.kms = kms; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 this.ws = ws; |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
62 |
1720
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
63 /** |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
64 * Add a W (in NN+m) for a km (in km). |
fa932d618989
Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1678
diff
changeset
|
65 */ |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 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
|
67 kms.add(km); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 ws .add(w); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
71 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
72 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 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
|
74 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
|
75 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
77 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
78 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 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
|
80 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
|
81 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 |
2420
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
83 @Override |
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
84 public boolean guessWaterIncreasing() { |
7081
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
85 return guessDataIncreasing(0.05f); |
2420
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
86 } |
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
87 |
7081
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
88 protected boolean guessDataIncreasing(float factor) { |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
89 return DataUtil.guessDataIncreasing(ws, factor); |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
90 } |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
91 |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
92 @Override |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
93 public boolean guessRTLData() { |
3c4efd4b2c19
Simplyfy / unify "invert axis" logic
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
94 return DataUtil.guessSameDirectionData(ws, allKms()); |
2420
65ff8ff20be4
Fix flys/issue150 ('water increasing').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1720
diff
changeset
|
95 } |
1162
588798ef4791
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
925
diff
changeset
|
96 |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
97 @Override |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 public int size() { |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 return kms.size(); |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 } |
1678
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
101 |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
102 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
103 public TDoubleArrayList allKms() { |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
104 return kms; |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
105 } |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
106 |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
107 @Override |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
108 public TDoubleArrayList allWs() { |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
109 return ws; |
03fbf1b30e72
Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1162
diff
changeset
|
110 } |
925
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 } |
0cb1a70b8b92
Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |