Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixRealizingCalculation.java @ 9479:2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
author | gernotbelger |
---|---|
date | Mon, 10 Sep 2018 15:31:55 +0200 |
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 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.fixings; |
3437
e111902834d3
FixA: Made calculation base class abstract. Sub classes are called with fixings overview an function to fit.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3420
diff
changeset
|
10 |
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:
9360
diff
changeset
|
11 import java.util.List; |
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:
9360
diff
changeset
|
12 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
13 import org.dive4elements.artifacts.CallMeta; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
14 import org.dive4elements.river.artifacts.access.FixRealizingAccess; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
15 import org.dive4elements.river.artifacts.math.fitting.Function; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
16 import org.dive4elements.river.artifacts.model.CalculationResult; |
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:
9360
diff
changeset
|
17 import org.dive4elements.river.artifacts.model.Parameters; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
18 import org.dive4elements.river.artifacts.model.RiverFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
19 import org.dive4elements.river.artifacts.model.Segment; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
20 import org.dive4elements.river.artifacts.model.WQKms; |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
21 import org.dive4elements.river.artifacts.resources.Resources; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5150
diff
changeset
|
22 import org.dive4elements.river.model.River; |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
23 |
5150
345f3bba6f15
Doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4968
diff
changeset
|
24 /** Calculation for FixRealize (german: ausgel. WSPL). */ |
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:
9360
diff
changeset
|
25 public class FixRealizingCalculation extends FixCalculation { |
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:
9360
diff
changeset
|
26 private static final long serialVersionUID = 1L; |
3414
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
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:
9360
diff
changeset
|
28 protected boolean isQ; |
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:
9360
diff
changeset
|
29 |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
30 protected List<Segment> segments; |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
31 |
3414
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 public FixRealizingCalculation() { |
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 } |
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
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:
9360
diff
changeset
|
35 public FixRealizingCalculation(final FixRealizingAccess access) { |
3420
7f7ab030a4e3
FixA: Minor refactoring
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3419
diff
changeset
|
36 super(access); |
7f7ab030a4e3
FixA: Minor refactoring
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3419
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:
9360
diff
changeset
|
38 final Boolean isQ = access.isQ(); |
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:
9360
diff
changeset
|
39 final List<Segment> segments = access.getSegments(); |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
40 |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
41 if (isQ == null) { |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
42 addProblem("fix.realize.missing.is.q"); |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
43 } |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
44 |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
45 if (segments == null || segments.isEmpty()) { |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
46 addProblem("fix.realize.missing.segments"); |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
47 } |
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
48 |
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:
9360
diff
changeset
|
49 final River r = RiverFactory.getRiver(this.river); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
50 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
51 if (r == null) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
52 addProblem("fix.no.such.river"); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
53 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
54 |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
55 if (!hasProblems()) { |
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:
9360
diff
changeset
|
56 this.isQ = isQ; |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
57 this.segments = segments; |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
58 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
59 // Convert from W to Q |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
60 Segment.setReferencePointConvertQ(segments, r, isQ, this); |
3419
da7cf0e3ccaa
FixA: Created a common base class for the fixing related calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3414
diff
changeset
|
61 } |
3414
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
3437
e111902834d3
FixA: Made calculation base class abstract. Sub classes are called with fixings overview an function to fit.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3420
diff
changeset
|
64 @Override |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
65 protected CalculationResult innerCalculate(final FixingsOverview overview, final Function func, final CallMeta meta) { |
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:
9360
diff
changeset
|
66 final ColumnCache cc = new ColumnCache(); |
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:
9360
diff
changeset
|
67 final FitResult fitResult = doFitting(overview, cc, func); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
68 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
69 if (fitResult == null) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
70 return new CalculationResult(this); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
71 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
72 |
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:
9360
diff
changeset
|
73 Segment segment = this.segments.get(0); |
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:
9360
diff
changeset
|
74 final int numResults = segment.numValues(); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
75 |
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:
9360
diff
changeset
|
76 final WQKms[] results = new WQKms[numResults]; |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
77 for (int i = 0; i < results.length; ++i) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
78 results[i] = new WQKms(); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
79 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
80 |
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:
9360
diff
changeset
|
81 final Parameters parameters = fitResult.getParameters(); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
82 |
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:
9360
diff
changeset
|
83 final int kmIndex = parameters.columnIndex("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:
9360
diff
changeset
|
84 final int[] parameterIndices = parameters.columnIndices(func.getParameterNames()); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
85 |
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:
9360
diff
changeset
|
86 final double[] parameterValues = new double[parameterIndices.length]; |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
87 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
88 for (int row = 0, R = parameters.size(); row < R; ++row) { |
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:
9360
diff
changeset
|
89 final double km = parameters.get(row, kmIndex); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
90 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
91 if (!segment.inside(km)) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
92 Segment nextSeg = null; |
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:
9360
diff
changeset
|
93 for (final Segment seg : this.segments) { |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
94 if (seg.inside(km)) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
95 nextSeg = seg; |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
96 break; |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
97 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
98 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
99 if (nextSeg == null) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
100 addProblem(km, "fix.cannot.find.segment"); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
101 continue; |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
102 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
103 segment = nextSeg; |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
104 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
105 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
106 parameters.get(row, parameterIndices, parameterValues); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
107 |
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:
9360
diff
changeset
|
108 final org.dive4elements.river.artifacts.math.Function instance = func.instantiate(parameterValues); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
109 |
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:
9360
diff
changeset
|
110 final double[] values = segment.getValues(); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
111 for (int i = 0; i < numResults; ++i) { |
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:
9360
diff
changeset
|
112 final double q = values[i]; |
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:
9360
diff
changeset
|
113 final double w = instance.value(q); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
114 |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
115 if (Double.isNaN(w)) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
116 addProblem(km, "fix.cannot.calculate.function", q); |
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:
9360
diff
changeset
|
117 } else { |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
118 results[i].add(w, q, km); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
119 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
120 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
121 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
122 |
5150
345f3bba6f15
Doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4968
diff
changeset
|
123 // Name the curves. |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
124 final String custom = Resources.getMsg(meta, "common.custom"); |
9360
ddcd52d239cd
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
gernotbelger
parents:
7546
diff
changeset
|
125 for (int i = 0; i < results.length; ++i) |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
126 results[i].setName(createName(i, custom)); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
127 |
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:
9360
diff
changeset
|
128 final FixRealizingResult frr = new FixRealizingResult(parameters, fitResult.getResultColumns(), results); |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
129 |
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
130 return new CalculationResult(frr, this); |
3414
1bb6fb621167
FixA: Added stub for the "Ausgelagerte Wasserspiegellagen" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
132 |
4968
d76705b68e73
FixRealizingCalculation: TODO/issue comment.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3603
diff
changeset
|
133 // TODO: issue1109/2 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
134 protected String createName(final int index, final String custom) { |
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:
9360
diff
changeset
|
135 final StringBuilder sb = new StringBuilder(this.isQ ? "Q" : "W"); |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9415
diff
changeset
|
136 sb.append(" ").append(custom).append(" ("); |
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:
9360
diff
changeset
|
137 for (int i = 0, N = this.segments.size(); i < N; ++i) { |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
138 if (i > 0) { |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
139 sb.append("; "); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
140 } |
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:
9360
diff
changeset
|
141 final Segment segment = this.segments.get(i); |
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:
9360
diff
changeset
|
142 final double[] backup = segment.getBackup(); |
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:
9360
diff
changeset
|
143 final double[] values = segment.getValues(); |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
144 sb.append((backup != null ? backup : values)[index]); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
145 } |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
146 sb.append(')'); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
147 return sb.toString(); |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3437
diff
changeset
|
148 } |
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:
9360
diff
changeset
|
149 } |