annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingColumnData.java @ 9648:c5a496bf1b0b

Fixed: Duplizieren einer Fixierungsanalyse schlägt fehl.
author Gernot Belger <g.belger@bjoernsen.de>
date Wed, 04 Dec 2019 16:10:28 +0100
parents 9744ce3c3853
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
9 package org.dive4elements.river.artifacts.model.fixings;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
12 import java.util.Arrays;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
14 import org.dive4elements.river.artifacts.math.Linear;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
15 import org.dive4elements.river.artifacts.model.QRangeTree;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
17 public class FixingColumnData implements Serializable {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
18 private static final long serialVersionUID = 1L;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
20 private double[] kms;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
21 private double[] ws;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
22
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
23 private QRangeTree qs;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
24
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
25 public FixingColumnData() {
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 }
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
28 public FixingColumnData(final double[] kms, final double[] ws, final QRangeTree qs) {
2619
6ed24efc80de Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2615
diff changeset
29 this.kms = kms;
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
30 this.ws = ws;
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
31 this.qs = qs;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
34 public boolean getW(final double km, final double[] w) {
2729
a441be7f1589 Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2619
diff changeset
35 return getW(km, w, 0);
a441be7f1589 Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2619
diff changeset
36 }
a441be7f1589 Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2619
diff changeset
37
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
38 public boolean getW(final double km, final double[] w, final int index) {
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
40 if (this.kms.length == 0 || km < this.kms[0] || km > this.kms[this.kms.length - 1]) {
2729
a441be7f1589 Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2619
diff changeset
41 w[index] = Double.NaN;
2615
b0597a63fe70 More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2610
diff changeset
42 return true;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 }
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
45 int idx = Arrays.binarySearch(this.kms, km);
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46
2615
b0597a63fe70 More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2610
diff changeset
47 if (idx >= 0) {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
48 w[index] = this.ws[idx];
2615
b0597a63fe70 More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2610
diff changeset
49 return true;
b0597a63fe70 More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2610
diff changeset
50 }
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 idx = -idx - 1;
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
54 w[index] = Linear.linear(km, this.kms[idx - 1], this.kms[idx], this.ws[idx - 1], this.ws[idx]);
2615
b0597a63fe70 More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2610
diff changeset
55 return false;
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 }
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
58 public double getQ(final double km) {
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
59 return this.qs.findQ(km);
2610
3c907758f0ab Added cacheable model for fixing column.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2729
diff changeset
61
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2729
diff changeset
62 public QRangeTree getQRanges() {
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
63 return this.qs;
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2729
diff changeset
64 }
9415
9744ce3c3853 Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents: 5994
diff changeset
65 }

http://dive4elements.wald.intevation.org