Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java @ 3776:1ddbf66a2b0a
Implemented the access for 'Auslagerung extremer Wasserspiegellagen'
flys-artifacts/trunk@5483 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 16 Sep 2012 17:55:10 +0000 |
parents | d52c4ca93ffb |
children | 048a02e29808 |
comparison
equal
deleted
inserted
replaced
3775:d52c4ca93ffb | 3776:1ddbf66a2b0a |
---|---|
1 package de.intevation.flys.artifacts.access; | 1 package de.intevation.flys.artifacts.access; |
2 | 2 |
3 import de.intevation.flys.artifacts.FLYSArtifact; | 3 import de.intevation.flys.artifacts.FLYSArtifact; |
4 | |
5 import de.intevation.flys.artifacts.model.RangeWithValues; | |
6 | |
7 import de.intevation.flys.utils.DoubleUtil; | |
8 | |
9 import java.util.ArrayList; | |
10 import java.util.List; | |
4 | 11 |
5 import org.apache.log4j.Logger; | 12 import org.apache.log4j.Logger; |
6 | 13 |
7 public class ExtremeAccess | 14 public class ExtremeAccess |
8 extends Access | 15 extends Access |
9 { | 16 { |
10 private static Logger log = Logger.getLogger(ExtremeAccess.class); | 17 private static Logger log = Logger.getLogger(ExtremeAccess.class); |
11 | 18 |
19 protected String river; | |
20 | |
21 protected Double from; | |
22 protected Double to; | |
23 protected Double step; | |
24 | |
25 protected Long start; | |
26 protected Long end; | |
27 | |
28 protected Double percent; | |
29 | |
30 protected String function; | |
31 | |
32 protected List<RangeWithValues> ranges; | |
33 | |
12 public ExtremeAccess() { | 34 public ExtremeAccess() { |
13 } | 35 } |
14 | 36 |
15 public ExtremeAccess(FLYSArtifact artifact) { | 37 public ExtremeAccess(FLYSArtifact artifact) { |
16 super(artifact); | 38 super(artifact); |
17 } | 39 } |
40 | |
41 public String getRiver() { | |
42 if (river == null) { | |
43 river = getString("river"); | |
44 } | |
45 if (log.isDebugEnabled()) { | |
46 log.debug("river: '" + river + "'"); | |
47 } | |
48 return river; | |
49 } | |
50 | |
51 public Double getFrom() { | |
52 | |
53 if (from == null) { | |
54 from = getDouble("ld_from"); | |
55 } | |
56 | |
57 if (log.isDebugEnabled()) { | |
58 log.debug("from: '" + from + "'"); | |
59 } | |
60 | |
61 return from; | |
62 } | |
63 | |
64 public Double getTo() { | |
65 | |
66 if (to == null) { | |
67 to = getDouble("ld_to"); | |
68 } | |
69 | |
70 if (log.isDebugEnabled()) { | |
71 log.debug("to: '" + to + "'"); | |
72 } | |
73 | |
74 return to; | |
75 } | |
76 | |
77 public Double getStep() { | |
78 | |
79 if (step == null) { | |
80 step = getDouble("ld_step"); | |
81 } | |
82 | |
83 if (log.isDebugEnabled()) { | |
84 log.debug("step: '" + step + "'"); | |
85 } | |
86 | |
87 return step; | |
88 } | |
89 | |
90 public Double getPercent() { | |
91 | |
92 if (percent == null) { | |
93 percent = getDouble("percent"); | |
94 } | |
95 | |
96 if (log.isDebugEnabled()) { | |
97 log.debug("percent: '" + percent + "'"); | |
98 } | |
99 | |
100 return percent; | |
101 } | |
102 | |
103 public String getFunction() { | |
104 if (function == null) { | |
105 function = getString("function"); | |
106 } | |
107 | |
108 if (log.isDebugEnabled()) { | |
109 log.debug("function: '" + function + "'"); | |
110 } | |
111 | |
112 return function; | |
113 } | |
114 | |
115 public List<RangeWithValues> getRanges() { | |
116 | |
117 if (ranges == null) { | |
118 String rangesS = getString("ranges"); | |
119 if (ranges == null) { | |
120 return null; | |
121 } | |
122 ranges = new ArrayList<RangeWithValues>(); | |
123 DoubleUtil.parseSegments(rangesS, new DoubleUtil.SegmentCallback() { | |
124 @Override | |
125 public void newSegment(double from, double to, double [] values) { | |
126 ranges.add(new RangeWithValues(from, to, values)); | |
127 } | |
128 }); | |
129 } | |
130 | |
131 if (log.isDebugEnabled()) { | |
132 log.debug("ranges: " + ranges); | |
133 } | |
134 | |
135 return ranges; | |
136 } | |
18 } | 137 } |
19 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 138 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |