annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java @ 4478:6153c50f78cf

WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine. Update all implementations. The change was done to be able to compute the extreme values during getWaterLine to access data needed in CrossSectionProfile Diagrams.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 13 Nov 2012 14:46:44 +0100
parents 2d3f8af87b7b
children f8217f1fef2e
rev   line source
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.access;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.flys.artifacts.FLYSArtifact;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
5 import de.intevation.flys.artifacts.model.RangeWithValues;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
6
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
7 import de.intevation.flys.utils.DoubleUtil;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
8
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
9 import java.util.ArrayList;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
10 import java.util.List;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
11
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import org.apache.log4j.Logger;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
4040
363445873737 Documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3777
diff changeset
14 /** Access data used for extreme value analysis. */
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 public class ExtremeAccess
3777
048a02e29808 Added base class RiverAccess to dense code to access the river name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3776
diff changeset
16 extends RiverAccess
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 {
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
18 /** Our private logger. */
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
19 private static Logger logger = Logger.getLogger(ExtremeAccess.class);
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
21 protected Double from;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
22 protected Double to;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
23 protected Double step;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
24
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
25 protected Long start;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
26 protected Long end;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
27
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
28 protected Double percent;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
29
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
30 protected String function;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
31
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
32 protected List<RangeWithValues> ranges;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
33
4052
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
34
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 public ExtremeAccess() {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
38
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 public ExtremeAccess(FLYSArtifact artifact) {
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 super(artifact);
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
42
4052
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
43
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
44 /** From (km) for calculation. */
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
45 public Double getFrom() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
46
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
47 if (from == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
48 from = getDouble("ld_from");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
49 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
50
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
51 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
52 logger.debug("from: '" + from + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
53 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
54
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
55 return from;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
56 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
57
4052
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
58
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
59 /** To (km) for calculation. */
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
60 public Double getTo() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
61
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
62 if (to == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
63 to = getDouble("ld_to");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
64 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
65
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
66 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
67 logger.debug("to: '" + to + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
68 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
69
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
70 return to;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
71 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
72
4052
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
73
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
74 /** Step width for calculation. */
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
75 public Double getStep() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
76
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
77 if (step == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
78 step = getDouble("ld_step");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
79 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
80
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
81 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
82 logger.debug("step: '" + step + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
83 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
84
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
85 return step;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
86 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
87
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
88
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
89 /** Returns the percent given. */
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
90 public Double getPercent() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
91
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
92 if (percent == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
93 percent = getDouble("percent");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
94 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
95
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
96 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
97 logger.debug("percent: '" + percent + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
98 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
99
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
100 return percent;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
101 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
102
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
103 public String getFunction() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
104 if (function == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
105 function = getString("function");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
106 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
107
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
108 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
109 logger.debug("function: '" + function + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
110 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
111
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
112 return function;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
113 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
114
4333
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
115
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
116 /** Find first RangeWithValues for which the given location
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
117 * is within the range and return its values.
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
118 * @return values of first suitable rangewithvalues or null.
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
119 */
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
120 public double[] getValuesForRange(double location) {
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
121 logger.debug("ExtemeAcces.getValuesForRange");
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
122 for (RangeWithValues rangeValues: getRanges()) {
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
123 if (rangeValues.inside(location)) {
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
124 return rangeValues.getValues();
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
125 }
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
126 }
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
127 return null;
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
128 }
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
129
2d3f8af87b7b ExtremeAccess: Added helper method to find the values for (the range of) a km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4332
diff changeset
130
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
131 public List<RangeWithValues> getRanges() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
132
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
133 if (ranges == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
134 String rangesS = getString("ranges");
4272
270f3ac8a82e In ExtremeAccess, fix typo that lead to incorrect null-check.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4052
diff changeset
135 if (rangesS == null) {
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
136 return null;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
137 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
138 ranges = new ArrayList<RangeWithValues>();
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
139 DoubleUtil.parseSegments(rangesS, new DoubleUtil.SegmentCallback() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
140 @Override
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
141 public void newSegment(double from, double to, double [] values) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
142 ranges.add(new RangeWithValues(from, to, values));
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
143 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
144 });
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
145 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
146
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
147 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
148 logger.debug("ranges: " + ranges);
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
149 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
150
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
151 return ranges;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
152 }
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org