Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java @ 4844:787733641877
Added tag 2.9.8 for changeset 88014b9852d0
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 23 Jan 2013 18:15:04 +0100 |
parents | 15e55fdbb402 |
children | c9a27912840d |
rev | line source |
---|---|
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.access; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.CallContext; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.FLYSArtifact; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.utils.FLYSUtils; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 /** For the moment, light-weight wrapper around FLYSUtils. */ |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 // TODO employ 'Caching' like other Accesses, remove usage of FLYSUtils. |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 public class RangeAccess |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 extends RiverAccess |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 private static Logger logger = Logger.getLogger(RangeAccess.class); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 private CallContext context; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
18 Double from; |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
19 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
20 Double to; |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
21 |
4825
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
22 Double step; |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
23 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 public RangeAccess(FLYSArtifact artifact, CallContext context) { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 super(artifact); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 this.context = context; |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
31 /** Return ld_from data (in km). */ |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
32 public double getFrom() { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
33 if (from == null) { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
34 from = getDouble("ld_from"); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
35 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
36 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
37 if (logger.isDebugEnabled()) { |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
38 logger.debug("from: '" + from + "'"); |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
39 } |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
40 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
41 return from.doubleValue(); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
42 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
43 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
44 |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
45 /** Return ld_to data (in km). */ |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
46 public double getTo() { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
47 if (to == null) { |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
48 to = getDouble("ld_to"); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
49 } |
4827
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
50 |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
51 if (logger.isDebugEnabled()) { |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
52 logger.debug("to: '" + to + "'"); |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
53 } |
15e55fdbb402
RangeAccess: Doc and debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4825
diff
changeset
|
54 |
4824
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
55 return to.doubleValue(); |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
56 } |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
57 |
d5d2faf14522
BedHeightQualityAccess, RangeAccess: Refactored, moved getFrom/To to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4699
diff
changeset
|
58 |
4825
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
59 /** Step width for calculation. */ |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
60 public Double getStep() { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
61 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
62 if (step == null) { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
63 step = getDouble("ld_step"); |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
64 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
65 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
66 if (logger.isDebugEnabled()) { |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
67 logger.debug("step: '" + step + "'"); |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
68 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
69 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
70 return step; |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
71 } |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
72 |
f8217f1fef2e
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4824
diff
changeset
|
73 |
4647
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 /** |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 * Get min and max kilometer, independent of parametization |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 * (ld_from/to vs ld_locations). |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 */ |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 public double[] getKmRange() { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 return FLYSUtils.getKmRange(this.getArtifact()); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 public double[] getKmFromTo() { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 return FLYSUtils.getKmFromTo(this.getArtifact()); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 /** |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 * Return sorted array of locations at which stuff was calculated |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 * (from ld_locations data), null if not parameterized this way. |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 */ |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 public double[] getLocations() { |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 return FLYSUtils.getLocations(this.getArtifact()); |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 } |
1fea4243721c
Add stubs for GaugeAccess and RangeAccess, for they do not get lost.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |