Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java @ 5211:9e11599266c8
Allow dots and numbers in oracle backend name
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 11 Mar 2013 09:53:16 +0100 |
parents | fc0cdcae8f07 |
children |
rev | line source |
---|---|
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
3 import de.intevation.flys.artifacts.access.Calculation4Access; |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
4 |
3441
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
5 import de.intevation.flys.artifacts.math.BackJumpCorrector; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
6 import de.intevation.flys.artifacts.math.Function; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
7 import de.intevation.flys.artifacts.math.Identity; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
8 import de.intevation.flys.artifacts.math.Linear; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
9 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
10 import de.intevation.flys.artifacts.model.RiverFactory; |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
11 |
3441
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
12 import de.intevation.flys.artifacts.model.WstValueTable.QPosition; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
13 |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
14 import de.intevation.flys.model.River; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.utils.DoubleUtil; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
18 import java.util.ArrayList; |
3441
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
19 import java.util.Arrays; |
bfbd478bd607
FixA: Moved Q -> W conversion code into segments to be reusable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3439
diff
changeset
|
20 import java.util.List; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.Logger; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 public class Calculation4 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
25 extends Calculation |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 private static Logger logger = Logger.getLogger(Calculation4.class); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public static final double MINIMAL_STEP_WIDTH = 1e-5; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 protected List<Segment> segments; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
33 protected boolean isQ; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
34 protected double from; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
35 protected double to; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
36 protected double step; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
37 protected String river; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 public Calculation4() { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
42 public Calculation4(Calculation4Access access) { |
4839
61ebb6fb2ac4
Fixed segments creation in calculation 4.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4835
diff
changeset
|
43 logger.debug("Calculation4Access.cnst"); |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
44 String river = access.getRiver(); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
45 List<Segment> segments = access.getSegments(); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
46 double [] range = access.getFromToStep(); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
47 boolean isQ = access.isQ(); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
49 if (river == null) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
50 addProblem("no.river.selected"); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
51 } |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
53 if (range == null) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
54 addProblem("no.range.found"); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
55 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
56 |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
57 if (segments == null || segments.isEmpty()) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
58 addProblem("cannot.create.segments"); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
59 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
60 |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
61 if (!hasProblems()) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
62 this.river = river; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
63 this.segments = segments; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
64 this.from = range[0]; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
65 this.to = range[1]; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
66 this.step = range[2]; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
67 this.isQ = isQ; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
68 } |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
71 public CalculationResult calculate() { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
72 if (hasProblems()) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
73 return new CalculationResult(new WQKms[0], this); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
74 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
75 |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
76 WstValueTable table = null; |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
77 River r = RiverFactory.getRiver(river); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
78 if (r == null) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
79 addProblem("no.river.found"); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
80 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
81 else { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
82 table = WstValueTableFactory.getTable(r); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
83 if (table == null) { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
84 addProblem("no.wst.for.river"); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
85 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
86 else { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
87 Segment.setReferencePointConvertQ(segments, r, isQ, this); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
88 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
89 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
90 |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
91 return hasProblems() |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
92 ? new CalculationResult(new WQKms[0], this) |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
93 : innerCalculate(table); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
94 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
95 |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4799
diff
changeset
|
96 protected CalculationResult innerCalculate(WstValueTable table) { |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 boolean debug = logger.isDebugEnabled(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 if (debug) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 logger.debug( |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 "calculate from " + from + " to " + to + " step " + step); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 logger.debug("# segments: " + segments.size()); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
103 for (Segment segment: segments) { |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
104 logger.debug(" " + segment); |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
105 } |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 int numResults = segments.get(0).values.length; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 if (numResults < 1) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 logger.debug("no values given"); |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
112 addProblem("no.values.given"); |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
113 return new CalculationResult(new WQKms[0], this); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 WQKms [] results = new WQKms[numResults]; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 for (int i = 0; i < results.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 results[i] = new WQKms(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 if (Math.abs(step) < MINIMAL_STEP_WIDTH) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 step = MINIMAL_STEP_WIDTH; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 if (from > to) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 step = -step; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 QPosition [] qPositions = new QPosition[numResults]; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 Function [] functions = new Function[numResults]; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 double [] out = new double[2]; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 Segment sentinel = new Segment(Double.MAX_VALUE); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 Segment s1 = sentinel, s2 = sentinel; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 for (double pos = from; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 from < to ? pos <= to : pos >= to; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 pos = DoubleUtil.round(pos + step) |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 ) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 if (pos < s1.referencePoint || pos > s2.referencePoint) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 if (debug) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 logger.debug("need to find new interval for " + pos); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 // find new interval |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 if (pos <= segments.get(0).referencePoint) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 // before first segment -> "gleichwertig" |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 if (debug) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 logger.debug("before first segment -> gleichwertig"); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 Segment first = segments.get(0); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 double [] values = first.values; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 double refPos = first.referencePoint; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 for (int i = 0; i < qPositions.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 qPositions[i] = table.getQPosition( |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 refPos, values[i]); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 sentinel.setReferencePoint(-Double.MAX_VALUE); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 s1 = sentinel; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 s2 = segments.get(0); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 Arrays.fill(functions, Identity.IDENTITY); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 else if (pos >= segments.get(segments.size()-1).referencePoint) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 // after last segment -> "gleichwertig" |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 if (debug) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 logger.debug("after last segment -> gleichwertig"); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 Segment last = segments.get(segments.size()-1); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 double [] values = last.values; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 double refPos = last.referencePoint; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 for (int i = 0; i < qPositions.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 qPositions[i] = table.getQPosition( |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 refPos, values[i]); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
177 sentinel.setReferencePoint(Double.MAX_VALUE); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
178 s1 = last; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
179 s2 = sentinel; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
180 Arrays.fill(functions, Identity.IDENTITY); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
182 else { // "ungleichwertig" |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
183 // find matching interval |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
184 if (debug) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 logger.debug("in segments -> ungleichwertig"); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 s1 = s2 = null; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 for (int i = 1, N = segments.size(); i < N; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 Segment si1 = segments.get(i-1); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 Segment si = segments.get(i); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 if (debug) { |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
739
diff
changeset
|
192 logger.debug("check " + pos + " in " + |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 si1.referencePoint + " - " + si.referencePoint); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 } |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
739
diff
changeset
|
195 if (pos >= si1.referencePoint |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 && pos <= si. referencePoint) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 s1 = si1; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
198 s2 = si; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 break; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
203 if (s1 == null) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 throw new IllegalStateException("no interval found"); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 Segment anchor, free; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 if (from > to) { anchor = s1; free = s2; } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 else { anchor = s2; free = s1; } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 // build transforms based on "gleichwertiger" phase |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 for (int i = 0; i < qPositions.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 QPosition qi = table.getQPosition( |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 anchor.referencePoint, |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 anchor.values[i]); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
217 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 if ((qPositions[i] = qi) == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
219 addProblem(pos, "cannot.find.q", anchor.values[i]); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
220 functions[i] = Identity.IDENTITY; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
221 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
222 else { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 double qA = table.getQ(qi, anchor.referencePoint); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 double qF = table.getQ(qi, free .referencePoint); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 functions[i] = Double.isNaN(qA) || Double.isNaN(qF) |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 ? Identity.IDENTITY |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 : new Linear( |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 qA, qF, |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 anchor.values[i], free.values[i]); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
231 |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
232 if (debug) { |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
233 logger.debug( |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
739
diff
changeset
|
234 anchor.referencePoint + ": " + |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
235 qA + " -> " + functions[i].value(qA) + |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
236 " / " + free.referencePoint + ": " + |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
237 qF + " -> " + functions[i].value(qF)); |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
238 } |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
240 } // build transforms |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 } // "ungleichwertiges" interval |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 } // find matching interval |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 for (int i = 0; i < qPositions.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
245 QPosition qPosition = qPositions[i]; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
246 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
247 if (qPosition == null) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 continue; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
249 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
250 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
251 if (table.interpolate(pos, out, qPosition, functions[i])) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
252 results[i].add(out[0], out[1], pos); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
253 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
254 else { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
742
diff
changeset
|
255 addProblem(pos, "cannot.interpolate.w.q"); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
256 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
257 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
258 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
259 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
260 // Backjump correction |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
261 for (int i = 0; i < results.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
262 BackJumpCorrector bjc = new BackJumpCorrector(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
263 |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
264 double [] ws = results[i].getWs(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
265 double [] kms = results[i].getKms(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
266 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
267 if (bjc.doCorrection(kms, ws, this)) { |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
268 results[i] = new WQCKms(results[i], bjc.getCorrected()); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
269 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
270 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
271 |
4967
2954eed04288
Calculation4: Doc and TODO/issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4839
diff
changeset
|
272 // Name the curves. |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
273 for (int i = 0; i < results.length; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
274 results[i].setName(createName(i)); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
275 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
276 |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
277 // Generate the "Umhuellende". |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
278 ConstantWQKms [] infoldings = |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
279 generateInfolding(table, results, from, to, step); |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
280 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
281 // TODO: Use qkms in a new result type. |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
282 WQKms [] newResults = new WQKms[results.length + infoldings.length]; |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
283 System.arraycopy( |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
284 results, 0, newResults, 0, results.length); |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
285 System.arraycopy( |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
286 infoldings, 0, newResults, results.length, infoldings.length); |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
287 |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
288 return new CalculationResult(newResults, this); |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
289 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
290 |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
291 protected ConstantWQKms [] generateInfolding( |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
292 WstValueTable wst, |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
293 WQKms [] results, |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
294 double from, |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
295 double to, |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
296 double step |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
297 ) { |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
298 WstValueTable.Column [] columns = wst.getColumns(); |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
299 |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
300 InfoldingColumns ic = new InfoldingColumns(columns); |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
301 ic.markInfoldingColumns(results); |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
302 |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
303 List<ConstantWQKms> infoldings = new ArrayList<ConstantWQKms>(); |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
304 |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
305 boolean [] infoldingColumns = ic.getInfoldingColumns(); |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
306 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
307 double [] kms = null; |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
308 double [] ws = null; |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
309 |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
310 for (int i = 0; i < infoldingColumns.length; ++i) { |
4799
e3532c7850b9
Trivial typo in selecting infolding columns.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4798
diff
changeset
|
311 if (!infoldingColumns[i]) { |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
312 continue; |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
313 } |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
314 |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
315 if (kms == null) { |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
316 kms = DoubleUtil.explode(from, to, step); |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
317 ws = new double[kms.length]; |
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
318 } |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
319 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
320 QRangeTree.QuickQFinder qf = |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
321 columns[i].getQRangeTree().new QuickQFinder(); |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
322 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
323 int numProblemsBefore = numProblems(); |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
324 double [] qs = qf.findQs(kms, this); |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
325 |
5138
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
326 String name = columns[i].getName(); |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
327 ConstantWQKms infolding = new ConstantWQKms(kms, qs, ws, name); |
4821
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
328 |
bcf25d8c183e
Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4812
diff
changeset
|
329 if (numProblems() > numProblemsBefore) { |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
330 infolding.removeNaNs(); |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
331 } |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
332 |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
333 infoldings.add(infolding); |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
334 } |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
335 |
5138
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
336 for (int i = 0; i < infoldings.size(); i++) { |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
337 String name = infoldings.get(i).getName(); |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
338 // TODO: i18n |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
339 if (i == 0) { |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
340 infoldings.get(i).setName("untere Umh\u00fcllende " + name); |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
341 } |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
342 else if (i == infoldings.size() - 1) { |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
343 infoldings.get(i).setName("obere Umh\u00fcllende " + name); |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
344 } |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
345 else { |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
346 infoldings.get(i).setName("geschnitten " + name); |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
347 } |
fc0cdcae8f07
New facet types and renaming for infoldings.
Raimund Renkert <rrenkert@intevation.de>
parents:
4967
diff
changeset
|
348 } |
4835
8e72777c961c
Introduced a fake ConstantWQKms class to have type information to only generate w facets for curves which really carry w data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4821
diff
changeset
|
349 return infoldings.toArray(new ConstantWQKms[infoldings.size()]); |
4798
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
350 } |
39885bdfc6fc
Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3450
diff
changeset
|
351 |
4967
2954eed04288
Calculation4: Doc and TODO/issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4839
diff
changeset
|
352 // TODO: issue1109/2, merge with FixRealizingCalculation |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
353 protected String createName(int index) { |
3450
22790758b132
FixA/Vollmer: return the result now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3441
diff
changeset
|
354 // TODO: i18n |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
355 StringBuilder sb = new StringBuilder(isQ ? "Q" : "W"); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
356 sb.append(" benutzerdefiniert ("); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
357 for (int i = 0, N = segments.size(); i < N; ++i) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
358 if (i > 0) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
359 sb.append("; "); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
360 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
361 Segment segment = segments.get(i); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
362 sb.append((segment.backup != null |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
363 ? segment.backup |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
364 : segment.values)[index]); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
365 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
366 sb.append(')'); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
367 return sb.toString(); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
368 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
369 } |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
370 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |