annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java @ 2784:156214e3ca55

FixA: Call computing when reaching the compute state. flys-artifacts/trunk@4523 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 26 May 2012 16:55:15 +0000
parents d999062c20e6
children 5642a83420f2
rev   line source
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
3 import de.intevation.flys.artifacts.math.Function;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
4 import de.intevation.flys.artifacts.math.Identity;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
5
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import gnu.trove.TDoubleArrayList;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 public class WW
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 extends W
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 {
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
11 public static class ApplyFunctionIterator
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
12 {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
13 protected Function function1;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
14 protected Function function2;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
15 protected int pos;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
16 protected WW ww;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
17
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
18 public ApplyFunctionIterator(WW ww) {
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
19 this(ww, Identity.IDENTITY, Identity.IDENTITY);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
20 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
21
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
22 public ApplyFunctionIterator(
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
23 WW ww,
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
24 Function function1,
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
25 Function function2
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
26 ) {
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
27 this.ww = ww;
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
28 this.function1 = function1;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
29 this.function2 = function2;
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
30 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
31
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
32 public boolean hasNext() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
33 return pos < ww.size();
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
34 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
35
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
36 public int size() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
37 return ww.size();
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
38 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
39
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
40 public void reset() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
41 pos = 0;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
42 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
43
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
44 public WW getWW() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
45 return ww;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
46 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
47
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
48 public void get(int idx, double [] wwPair) {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
49 wwPair[0] = function1.value(ww.getW(idx));
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
50 wwPair[1] = function2.value(ww.getW2(idx));
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
51 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
52
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
53 public void next(double [] wwPair) {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
54 get(pos++, wwPair);
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
55 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
56 } // class FunctionIterator
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
57
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 protected TDoubleArrayList ws2;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
60 protected double startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
61 protected double endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
62
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
63 protected Double startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
64 protected Double endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
65
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 public WW() {
2271
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2256
diff changeset
67 this("");
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 public WW(String name) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 super(name);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 public WW(int capacity) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 this(capacity, "");
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 public WW(int capacity, String name) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 super(capacity, name);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 ws2 = new TDoubleArrayList(capacity);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
83 public WW(
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
84 String name,
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
85 double startKm,
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
86 Double startDatum,
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
87 double [] ws,
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
88 double endKm,
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
89 Double endDatum,
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
90 double [] ws2
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
91 ) {
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
92 this.name = name;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
93 this.ws = new TDoubleArrayList(ws);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
94 this.ws2 = new TDoubleArrayList(ws2);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
95 this.startKm = startKm;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
96 this.startDatum = startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
97 this.endKm = endKm;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
98 this.endDatum = endDatum;
2186
ec2574eb2d32 Added calculation class for "Bezugslinienverfahren" to created by WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2182
diff changeset
99 }
ec2574eb2d32 Added calculation class for "Bezugslinienverfahren" to created by WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2182
diff changeset
100
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
101 public WW(String name, TDoubleArrayList ws, TDoubleArrayList ws2) {
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
102 this.name = name;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
103 this.ws = ws;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
104 this.ws2 = ws2;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
105 }
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
106
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 public void add(double w1, double w2) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 ws .add(w1);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 ws2.add(w2);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111
2229
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
112 public double getW1(int idx) {
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
113 return ws.getQuick(idx);
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
114 }
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
115
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 public double getW2(int idx) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 return ws2.getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 public double [] getWs2() {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 return ws2.toNativeArray();
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 public double [] get(int idx) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 return get(idx, new double[2]);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 public double [] get(int idx, double [] dst) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 dst[0] = ws .getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 dst[1] = ws2.getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 return dst;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
136 public double getStartKm() {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
137 return startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
138 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
139
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
140 public void setStartKm(double startKm) {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
141 this.startKm = startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
142 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
143
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
144 public double getEndKm() {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
145 return endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
146 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
147
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
148 public void setEndKm(double endKm) {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
149 this.endKm = endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
150 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
151
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
152 public Double getStartDatum() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
153 return startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
154 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
155
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
156 public boolean startAtGauge() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
157 return startDatum != null;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
158 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
159
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
160 public boolean endAtGauge() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
161 return endDatum != null;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
162 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
163
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
164 public void setStartDatum(Double startDatum) {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
165 this.startDatum = startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
166 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
167
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
168 public Double getEndDatum() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
169 return endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
170 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
171
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
172 public void setEndDatum(Double endDatum) {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
173 this.endDatum = endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
174 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
175
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177 public void removeNaNs() {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 removeNaNs(new TDoubleArrayList [] { ws, ws2 });
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 }
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
180
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
181 public double minWs2() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
182 return ws2.min();
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
183 }
2329
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
184
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
185 // Note that we can also easily define a Function to do so.
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
186 public double getRelHeight1Cm(int idx) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
187 if (this.startAtGauge()) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
188 return (ws.getQuick(idx) - getStartDatum())*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
189 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
190 else return ws.getQuick(idx)*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
191 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
192
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
193 public double getRelHeight2Cm(int idx) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
194 if (this.endAtGauge()) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
195 return (ws2.getQuick(idx) - getEndDatum())*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
196 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
197 else return ws2.getQuick(idx)*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
198 }
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org