annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWQQ.java @ 4837:9e25c7523485

Fixed calculation of effective width in MINFO SQ relation. * Get all (including empty datasets) from db. * Filter empty datasets when processing data of the same date. * Added debug outputs.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 23 Jan 2013 11:14:41 +0100
parents 5642a83420f2
children bcf25d8c183e
rev   line source
2271
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.flys.artifacts.math.Identity;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import gnu.trove.TDoubleArrayList;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 public class WWQQ
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 extends WW
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 public static class ApplyFunctionIterator
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 extends WW.ApplyFunctionIterator
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 public ApplyFunctionIterator(WWQQ ww) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 super(ww, Identity.IDENTITY, Identity.IDENTITY);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 @Override
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 public void get(int idx, double [] wwqqPair) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 WWQQ wwqq = (WWQQ)ww;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 wwqqPair[0] = function1.value(wwqq.getW(idx));
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 wwqqPair[1] = function2.value(wwqq.getW2(idx));
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 wwqqPair[2] = wwqq.getQ1(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 wwqqPair[3] = wwqq.getQ2(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 } // class ApplyFunctionIterator
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 protected TDoubleArrayList qs1;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 protected TDoubleArrayList qs2;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public WWQQ() {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 this("");
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 public WWQQ(String name) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 super(name);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 public WWQQ(int capacity) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 this(capacity, "");
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 public WWQQ(int capacity, String name) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 super(capacity, name);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 public WWQQ(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2271
diff changeset
47 String name,
2271
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 double startKm,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 Double startDatum,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 double [] ws1,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 double [] qs1,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 double endKm,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 Double endDatum,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 double [] ws2,
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 double [] qs2
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 ) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 super(name, startKm, startDatum, ws1, endKm, endDatum, ws2);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 this.qs1 = new TDoubleArrayList(qs1);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 this.qs2 = new TDoubleArrayList(qs2);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 public double getQ1(int idx) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 return qs1.getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 public double getQ2(int idx) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 return qs2.getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 public double [] getQs1() {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 return qs1.toNativeArray();
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 public double [] getQs2() {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 return qs2.toNativeArray();
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 @Override
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 public double [] get(int idx) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 return get(idx, new double[4]);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 @Override
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 public double [] get(int idx, double [] dst) {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 dst[0] = ws .getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 dst[1] = ws2.getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 dst[2] = qs1.getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 dst[3] = qs2.getQuick(idx);
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 return dst;
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 @Override
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 public void removeNaNs() {
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 removeNaNs(new TDoubleArrayList [] { ws, ws2, qs1, qs2 });
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 }
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org