Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | d4e39cc5c10c |
children | bf2fd9c58ac4 |
rev | line source |
---|---|
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.sq; |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
3 import java.util.List; |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.Map; |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
6 import org.apache.commons.logging.Log; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
7 import org.apache.commons.logging.LogFactory; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
8 |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 public class Measurement |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 { |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
11 private static final Log log = |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
12 LogFactory.getLog(Measurement.class); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
13 |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
14 public static final double ADD_8 = Math.log(10) - Math.log(8)/Math.log(6.3); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
15 public static final double SCALE_8 = Math.log(6.3); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
16 |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
17 public static final double ADD_4 = Math.log(8) - Math.log(6.3)/Math.log(10); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
18 public static final double SCALE_4 = Math.log(6.3); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
19 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
20 protected Map<String, Object> data; |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
21 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
22 protected List<Sieve> sieves; |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
23 |
4002
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
24 protected SieveArray sieveArray; |
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
25 |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public Measurement() { |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 } |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
29 public Measurement(Map<String, Object> data, List<Sieve> sieves) { |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 this.data = data; |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
31 this.sieves = sieves; |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
32 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
33 |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
34 protected double get(String name) { |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
35 Number value = (Number)data.get(name); |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
36 return value != null ? value.doubleValue() : Double.NaN; |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
37 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
38 |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
39 protected void set(String name, double value) { |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
40 data.put(name, Double.valueOf(value)); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
41 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
42 |
4001
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
43 public Object getData(String name) { |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
44 return data.get(name); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
45 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
46 |
4001
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
47 public Map<String, Object> getData() { |
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
48 return data; |
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
49 } |
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
50 |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
51 protected void putData(String name, Object value) { |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
52 data.put(name, value); |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
53 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
54 |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
55 public double S_SS() { |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
56 return get("TSAND"); |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
57 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
58 |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
59 public double S_SF() { |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
60 return get("TSCHWEB") - get("TSAND"); |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
61 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
62 |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
63 public double Q() { |
3393
525e976102ac
S/Q relation: Out commented the LEFT JOINs which produce a lot of empty and
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3389
diff
changeset
|
64 return get("Q_BPEGEL"); |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
65 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
66 |
3389
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
67 public double TOTAL_BL() { |
3922
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
68 return get("TGESCHIEBE"); |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
69 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
70 |
3922
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
71 public double BL_G() { |
4005
22abdc45869c
Calculate S(Q) fractions
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4002
diff
changeset
|
72 return get("BL_G"); |
3389
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
73 } |
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
74 |
3922
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
75 public double BL_C() { |
4005
22abdc45869c
Calculate S(Q) fractions
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4002
diff
changeset
|
76 return get("BL_C"); |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
77 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
78 |
3922
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
79 public double BL_S() { |
4005
22abdc45869c
Calculate S(Q) fractions
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4002
diff
changeset
|
80 return get("BL_S"); |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
81 } |
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
82 |
3922
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
83 public double S_BL_S() { |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
84 return TOTAL_BL() * BL_S(); |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
85 } |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
86 |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
87 public double S_BL_FG() { |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
88 return TOTAL_BL() * BL_G(); |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
89 } |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
90 |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
91 public double S_BL_CG() { |
e1d3f6bccf2b
S/Q: More symbols in reconstruction of Excel macros.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3393
diff
changeset
|
92 return TOTAL_BL() * BL_C(); |
3290
36f3b53d5cfc
SQ relation: Added infrastructure to extract fractions from measurments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3289
diff
changeset
|
93 } |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 |
3389
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
95 public double S_BL_1() { |
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
96 return S_BL_S() + S_BL_FG() + S_BL_CG(); |
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
97 } |
3293
c15738c831db
SQ relation: Added access to the data of GSIEBSATZ and SSIEBUNG.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3290
diff
changeset
|
98 |
3389
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
99 public double S_BL_2() { |
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
100 return S_SS() + S_BL_S() + S_BL_FG() + S_BL_CG(); |
816ceb0418b9
Q is not taken from MESSUNG.Q but from MESSUNG.Q_BPEGEL
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3293
diff
changeset
|
101 } |
3293
c15738c831db
SQ relation: Added access to the data of GSIEBSATZ and SSIEBUNG.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3290
diff
changeset
|
102 |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 @Override |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 public String toString() { |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 return "Measurement: " + data; |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 } |
3928
d3e2080d3ada
S(Q) relation. Extract more values from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3922
diff
changeset
|
107 |
d3e2080d3ada
S(Q) relation. Extract more values from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3922
diff
changeset
|
108 /** |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
109 * Gets the sieves for this instance. |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
110 * |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
111 * @return The sieves. |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
112 */ |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
113 public List<Sieve> getSieves() { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
114 return this.sieves; |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
115 } |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
116 |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
117 /** |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
118 * Gets the sieveArray for this instance. |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
119 * |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
120 * @return The sieveArray. |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
121 */ |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
122 public SieveArray getSieveArray() { |
4002
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
123 if (sieveArray == null) { |
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
124 sieveArray = calculateSieveArray(); |
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
125 } |
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
126 return sieveArray; |
3928
d3e2080d3ada
S(Q) relation. Extract more values from database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3922
diff
changeset
|
127 } |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
128 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
129 protected Sieve findSieve(double diameter) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
130 for (Sieve s: sieves) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
131 if (s.matchesDiameter(diameter)) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
132 return s; |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
133 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
134 } |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
135 return null; |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
136 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
137 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
138 protected void deleteSieve(double diameter) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
139 for (int i = sieves.size()-1; i >= 0; --i) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
140 if (sieves.get(i).matchesDiameter(diameter)) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
141 sieves.remove(i); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
142 break; |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
143 } |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
144 } |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
145 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
146 |
4001
ab3a4ad82ae1
S(Q) accumulated same diameter meassurements per bank distance.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3992
diff
changeset
|
147 public void adjustSieves() { |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
148 |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
149 // If we already have an 8mm diameter sieve |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
150 // we dont need to 'invent' it. |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
151 if (findSieve(8d) != null) { |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
152 return; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
153 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
154 |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
155 // create a new 8mm sieve. |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
156 // delete 6.3mm sieve. |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
157 // modify 4mm sieve. |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
158 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
159 Sieve six = findSieve(6.3d); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
160 Sieve ten = findSieve(10d); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
161 Sieve four = findSieve(4d); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
162 |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
163 if (six == null || ten == null || four == null) { |
4006
d4e39cc5c10c
S(Q) relation: Removed unused field from SQL statement.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4005
diff
changeset
|
164 log.warn("missing diameter"); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
165 return; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
166 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
167 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
168 double sixValue = six.getLoad(); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
169 double tenValue = ten.getLoad(); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
170 double fourValue = four.getLoad(); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
171 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
172 deleteSieve(6.3); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
173 |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
174 double eightValue = ADD_8 - SCALE_8*sixValue + tenValue; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
175 double newFourValue = ADD_4 - SCALE_4*sixValue + fourValue; |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
176 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
177 sieves.add(new Sieve(8d, eightValue)); |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
178 sieves.add(new Sieve(4d, newFourValue)); |
4002
fdc6b1e64d01
Fix compiling bug
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4001
diff
changeset
|
179 } |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
180 |
4005
22abdc45869c
Calculate S(Q) fractions
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4002
diff
changeset
|
181 protected SieveArray calculateSieveArray() { |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
182 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
183 SieveArray sa = new SieveArray(); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
184 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
185 for (Sieve s: sieves) { |
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
186 sa.doSieving(s); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
187 } |
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
188 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
189 sa.calculateNormLoads(); |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
190 |
3992
a9c93b7c9da1
Simpify the S(Q) fraction sieving stuff.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3981
diff
changeset
|
191 return sa; |
3981
6bcc50e2cc7d
More code for S(Q) relation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3928
diff
changeset
|
192 } |
3289
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 } |
ec9aab93f292
SQ: First peek into fetching relevant data from SedDB
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |