annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsImpl.java @ 1999:02ce03329ef5

Some optimizations during out() operation of FLYSArtifactCollection. flys-artifacts/trunk@3437 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 16 Dec 2011 11:47:57 +0000
parents fa932d618989
children 65ff8ff20be4
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
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
19 /**
fa932d618989 Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1678
diff changeset
20 * 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
21 */
fa932d618989 Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1678
diff changeset
22 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
23 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
24 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
25 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
26 }
fa932d618989 Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1678
diff changeset
27
fa932d618989 Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1678
diff changeset
28
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 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
30 super("");
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 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
32 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
33 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
35
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 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
37 this(kms, ws, "");
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
40
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 public WKmsImpl(
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 TDoubleArrayList kms,
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 TDoubleArrayList ws,
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 String name
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 super(name);
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 this.kms = kms;
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 this.ws = 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
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
52 /**
fa932d618989 Added constructor that will be needed in creation of WKms for 'static' data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1678
diff changeset
53 * 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
54 */
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 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
56 kms.add(km);
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 ws .add(w);
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
60
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
61 @Override
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 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
63 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
64 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
66
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
67 @Override
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 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
69 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
70 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 925
diff changeset
72
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
73 @Override
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 public int size() {
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 return kms.size();
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 }
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
77
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
78 @Override
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
79 public TDoubleArrayList allKms() {
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
80 return kms;
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
81 }
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
82
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
83 @Override
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
84 public TDoubleArrayList allWs() {
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
85 return ws;
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1162
diff changeset
86 }
925
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 }
0cb1a70b8b92 Added the math needed to calculate "W-Differenzen" in "Laengsschnitten"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org