annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java @ 5164:8c65acf01adc 2.9.10

Fixed datacage to be oracle compatible.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 04 Mar 2013 11:44:11 +0100
parents f8217f1fef2e
children
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
4825
f8217f1fef2e ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4333
diff changeset
3 import de.intevation.artifacts.CallContext;
f8217f1fef2e ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4333
diff changeset
4
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 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
6
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
7 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
8
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
9 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
10
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
11 import java.util.ArrayList;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
12 import java.util.List;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
13
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
4040
363445873737 Documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3777
diff changeset
16 /** 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
17 public class ExtremeAccess
4825
f8217f1fef2e ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4333
diff changeset
18 extends RangeAccess
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 {
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
20 /** Our private logger. */
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
21 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
22
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
23 protected Long start;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
24 protected Long end;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
25
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
26 protected Double percent;
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 String function;
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 List<RangeWithValues> ranges;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
31
4052
6d8c7a00e74e Do cumentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4040
diff changeset
32
4825
f8217f1fef2e ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4333
diff changeset
33 public ExtremeAccess(FLYSArtifact artifact, CallContext context) {
f8217f1fef2e ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4333
diff changeset
34 super(artifact, context);
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
35 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
36
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
37
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
38 /** Returns the percent given. */
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
39 public Double getPercent() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
40
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
41 if (percent == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
42 percent = getDouble("percent");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
43 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
44
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
45 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
46 logger.debug("percent: '" + percent + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
47 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
48
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
49 return percent;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
50 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
51
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
52 public String getFunction() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
53 if (function == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
54 function = getString("function");
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
55 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
56
4332
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
57 if (logger.isDebugEnabled()) {
0545002e112c ExtremeAccess: Renamed log to logger, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4272
diff changeset
58 logger.debug("function: '" + function + "'");
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
59 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
60
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
61 return function;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
62 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
63
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
64
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
65 /** 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
66 * 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
67 * @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
68 */
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
69 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
70 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
71 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
72 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
73 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
74 }
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
75 }
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
76 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
77 }
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
78
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
79
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
80 public List<RangeWithValues> getRanges() {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
81
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
82 if (ranges == null) {
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
83 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
84 if (rangesS == null) {
3776
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
85 return null;
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 ranges = new ArrayList<RangeWithValues>();
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
88 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
89 @Override
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
90 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
91 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
92 }
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
93 });
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("ranges: " + ranges);
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 ranges;
1ddbf66a2b0a Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3775
diff changeset
101 }
3775
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 }
d52c4ca93ffb More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org