comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAnalysisAccess.java @ 3418:21c1d1d25919

FixA: Moved common parameter access to common base class. flys-artifacts/trunk@5071 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 15:44:14 +0000
parents 0ef83077c93f
children 8160e62bbb3a
comparison
equal deleted inserted replaced
3417:ed9689fbcd26 3418:21c1d1d25919
10 import java.util.Date; 10 import java.util.Date;
11 11
12 import org.apache.log4j.Logger; 12 import org.apache.log4j.Logger;
13 13
14 public class FixAnalysisAccess 14 public class FixAnalysisAccess
15 extends Access 15 extends FixAccess
16 { 16 {
17 private static Logger log = Logger.getLogger(FixAnalysisAccess.class); 17 private static Logger log = Logger.getLogger(FixAnalysisAccess.class);
18 18
19 protected String river;
20
21 protected String calculationMode;
22
23 protected Double from;
24 protected Double to;
25 protected Double step;
26
27 protected Long start;
28 protected Long end;
29
30 protected Integer qSectorStart;
31 protected Integer qSectorEnd;
32
33 protected DateRange referencePeriod; 19 protected DateRange referencePeriod;
34 protected DateRange [] analysisPeriods; 20 protected DateRange [] analysisPeriods;
35
36 protected int [] events;
37
38 protected Boolean preprocessing;
39
40 protected String function;
41 21
42 protected double [] qs; 22 protected double [] qs;
43 23
44 public FixAnalysisAccess() { 24 public FixAnalysisAccess() {
45 } 25 }
46 26
47 public FixAnalysisAccess(FLYSArtifact artifact) { 27 public FixAnalysisAccess(FLYSArtifact artifact) {
48 super(artifact); 28 super(artifact);
49 }
50
51 public String getRiver() {
52 if (river == null) {
53 river = getString("river");
54 }
55 if (log.isDebugEnabled()) {
56 log.debug("river: '" + river + "'");
57 }
58 return river;
59 }
60
61 public String getCalculationMode() {
62 if (calculationMode == null) {
63 calculationMode = getString("calculation.mode");
64 }
65
66 if (log.isDebugEnabled()) {
67 log.debug("calculationMode: '" + calculationMode + "'");
68 }
69 return calculationMode;
70 }
71
72 public Double getFrom() {
73
74 if (from == null) {
75 from = getDouble("from");
76 }
77
78 if (log.isDebugEnabled()) {
79 log.debug("from: '" + from + "'");
80 }
81
82 return from;
83 }
84
85 public Double getTo() {
86
87 if (to == null) {
88 to = getDouble("to");
89 }
90
91 if (log.isDebugEnabled()) {
92 log.debug("to: '" + to + "'");
93 }
94
95 return to;
96 }
97
98 public Double getStep() {
99
100 if (step == null) {
101 step = getDouble("step");
102 }
103
104 if (log.isDebugEnabled()) {
105 log.debug("step: '" + step + "'");
106 }
107
108 return step;
109 }
110
111 public Long getStart() {
112
113 if (start == null) {
114 start = getLong("start");
115 }
116
117 if (log.isDebugEnabled()) {
118 log.debug("start: '" + start + "'");
119 }
120
121 return start;
122 }
123
124 public Long getEnd() {
125
126 if (end == null) {
127 end = getLong("end");
128 }
129
130 if (log.isDebugEnabled()) {
131 log.debug("end: '" + end + "'");
132 }
133
134 return end;
135 }
136
137 public Integer getQSectorStart() {
138
139 if (qSectorStart == null) {
140 qSectorStart = getInteger("q1");
141 }
142
143 if (log.isDebugEnabled()) {
144 log.debug("q1: '" + qSectorStart + "'");
145 }
146
147 return qSectorStart;
148 }
149
150 public Integer getQSectorEnd() {
151
152 if (qSectorEnd == null) {
153 qSectorEnd = getInteger("q2");
154 }
155
156 if (log.isDebugEnabled()) {
157 log.debug("q2: '" + qSectorEnd + "'");
158 }
159
160 return qSectorEnd;
161 }
162
163 public int [] getEvents() {
164 if (events == null) {
165 events = getIntArray("events");
166 }
167 if (log.isDebugEnabled() && events != null) {
168 log.debug("events: " + Arrays.toString(events));
169 }
170 return events;
171 } 29 }
172 30
173 public DateRange getReferencePeriod() { 31 public DateRange getReferencePeriod() {
174 if (referencePeriod == null) { 32 if (referencePeriod == null) {
175 StateData refStart = artifact.getData("ref_start"); 33 StateData refStart = artifact.getData("ref_start");
215 73
216 Date from = refP.getFrom(); 74 Date from = refP.getFrom();
217 Date to = refP.getTo(); 75 Date to = refP.getTo();
218 76
219 DateRange[] rs = getAnalysisPeriods(); 77 DateRange[] rs = getAnalysisPeriods();
220 for(DateRange r : rs) { 78 for (DateRange r: rs) {
221 if(r.getFrom().before(from)) { 79 if (r.getFrom().before(from)) {
222 from = r.getFrom(); 80 from = r.getFrom();
223 } 81 }
224 if(r.getTo().after(to)) { 82 if (r.getTo().after(to)) {
225 to = r.getTo(); 83 to = r.getTo();
226 } 84 }
227 } 85 }
228 86
229 return new DateRange(from, to); 87 return new DateRange(from, to);
230 }
231
232 public Boolean getPreprocessing() {
233 if (preprocessing == null) {
234 preprocessing = getBoolean("preprocessing");
235 }
236 if (log.isDebugEnabled()) {
237 log.debug("preprocessing: " + preprocessing);
238 }
239 return preprocessing;
240 }
241
242 public String getFunction() {
243 if (function == null) {
244 function = getString("function");
245 }
246 if (log.isDebugEnabled()) {
247 log.debug("function: " + function);
248 }
249 return function;
250 } 88 }
251 89
252 public double [] getQs() { 90 public double [] getQs() {
253 if (qs == null) { 91 if (qs == null) {
254 qs = getDoubleArray("qs"); 92 qs = getDoubleArray("qs");

http://dive4elements.wald.intevation.org