annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java @ 3025:5d286d7e54cd

FixA: Prevent duplicates in analysis periods. flys-artifacts/trunk@4592 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 05 Jun 2012 15:37:38 +0000
parents e5e6363e6cba
children 77b5f5a26700
rev   line source
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
3 import de.intevation.artifactdatabase.data.StateData;
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
4
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
5 import de.intevation.flys.artifacts.model.fixings.DateRange;
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
6
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
7 import de.intevation.flys.utils.FLYSUtils;
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
8
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
9 import gnu.trove.TDoubleArrayList;
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
10
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
11 import java.util.ArrayList;
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import java.util.Arrays;
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
13 import java.util.Date;
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 public class FixationArtifactAccess
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 private static Logger log = Logger.getLogger(FixationArtifactAccess.class);
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 protected FLYSArtifact artifact;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 protected String river;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 protected String calculationMode;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 protected Double from;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 protected Double to;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 protected Double step;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 protected Long start;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 protected Long end;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 protected Integer qSectorStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 protected Integer qSectorEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 protected Long referenceStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 protected Long referenceEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
40 protected DateRange [] analysisPeriods;
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 protected int [] events;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 protected Boolean preprocessing;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 protected String function;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 protected double [] qs;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 public FixationArtifactAccess() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 public FixationArtifactAccess(FLYSArtifact artifact) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 this.artifact = artifact;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 public FLYSArtifact getArtifact() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 return artifact;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 public String getRiver() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 if (river == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 StateData sd = artifact.getData("river");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 log.warn("missing 'river' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 river = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 log.debug("river: '" + river + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 return river;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 public String getCalculationMode() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 if (calculationMode == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 StateData sd = artifact.getData("calculation.mode");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 log.warn("missing 'calculation.mode' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 calculationMode = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 log.debug("calculationMode: '" + calculationMode + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 return calculationMode;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 public Double getFrom() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 if (from == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 StateData sd = artifact.getData("from");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 log.warn("missing 'from' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 from = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 log.warn("from '" + sd.getValue() + "' is not numeric.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 log.debug("from: '" + from + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 return from;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115 public Double getTo() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 if (to == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 StateData sd = artifact.getData("to");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 log.warn("missing 'to' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 to = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 log.warn("to '" + sd.getValue() + "' is not numeric.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 log.debug("to: '" + to + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 return to;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 public Double getStep() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140 if (step == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141 StateData sd = artifact.getData("step");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 log.warn("missing 'step' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 step = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
149 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 log.warn("step '" + sd.getValue() + "' is not numeric.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155 log.debug("step: '" + step + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158 return step;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
160
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
161 public Long getStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
162
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
163 if (start == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 StateData sd = artifact.getData("start");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
166 log.warn("missing 'start' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
167 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
168 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
169 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
170 start = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
173 log.warn("start '" + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 log.debug("start: '" + start + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 return start;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 public Long getEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 if (end == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
187 StateData sd = artifact.getData("end");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189 log.warn("missing 'end' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 end = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
194 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
195 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 log.warn("end '" + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
198 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 log.debug("end: '" + end + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 return end;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 public Integer getQSectorStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 if (qSectorStart == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 StateData sd = artifact.getData("q1");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212 log.warn("missing 'q1' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
216 qSectorStart = Integer.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
217 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219 log.warn("q1 '" + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
221 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
223 return qSectorStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
225
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 public Integer getQSectorEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 if (qSectorEnd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 StateData sd = artifact.getData("q2");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231 log.warn("missing 'q2' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
232 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
233 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
234 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235 qSectorEnd = Integer.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
236 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
237 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
238 log.warn("q2 '" + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
239 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
240 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
241
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
242 return qSectorEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
243 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
244
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
245 public int [] getEvents() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
246 if (events == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
247 StateData sd = artifact.getData("events");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
248 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
249 log.warn("missing 'events' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
250 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
251 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
252 events = FLYSUtils.intArrayFromString((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
253 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
254 return events;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
255 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
256
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
257 public Long getReferenceStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258 if (referenceStart == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
259 StateData sd = artifact.getData("ref_start");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
260 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261 log.warn("missing 'ref_start' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 referenceStart = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268 log.warn("ref_start '"
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269 + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
270 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 log.debug("referenceStart: '" + referenceStart + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
275 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
276
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277 return referenceStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
278 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 public Long getReferenceEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 if (referenceEnd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
282 StateData sd = artifact.getData("ref_end");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
283 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
284 log.warn("missing 'ref_end' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
288 referenceEnd = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
289 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
290 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291 log.warn("ref_end '"
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 + sd.getValue() + "' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 log.debug("referenceEnd: '" + referenceEnd + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
298 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 return referenceEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
302
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
303 public DateRange [] getAnalysisPeriods() {
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304 if (analysisPeriods == null) {
3000
3dd1c320cf81 Changed data fields in fixings analysisperiods state.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2726
diff changeset
305 StateData sd = artifact.getData("ana_data");
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306
3000
3dd1c320cf81 Changed data fields in fixings analysisperiods state.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2726
diff changeset
307 if (sd == null) {
3dd1c320cf81 Changed data fields in fixings analysisperiods state.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2726
diff changeset
308 log.warn("missing 'ana_data'");
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
309 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
310 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
311
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
312 String data = (String)sd.getValue();
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
313 String[] pairs = data.split("\\s*;\\s*");
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
314
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
315 ArrayList<DateRange> aPs = new ArrayList<DateRange>(pairs.length);
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
316
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
317 for (int i = 0; i < pairs.length; i++) {
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
318 String[] fromTo = pairs[i].split("\\s*,\\s*");
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
319 if (fromTo.length >= 2) {
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
320 try {
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
321 Date from = new Date(Long.parseLong(fromTo[0]));
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
322 Date to = new Date(Long.parseLong(fromTo[1]));
3025
5d286d7e54cd FixA: Prevent duplicates in analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3003
diff changeset
323 DateRange aP = new DateRange(from, to);
5d286d7e54cd FixA: Prevent duplicates in analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3003
diff changeset
324 if (!aPs.contains(aP)) {
5d286d7e54cd FixA: Prevent duplicates in analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3003
diff changeset
325 aPs.add(aP);
5d286d7e54cd FixA: Prevent duplicates in analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3003
diff changeset
326 }
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
327 }
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
328 catch (NumberFormatException nfe) {
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
329 log.warn("ana_data contains no long values.", nfe);
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
330 }
3000
3dd1c320cf81 Changed data fields in fixings analysisperiods state.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2726
diff changeset
331 }
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 }
3001
619fe13e2397 FixA: Fixed access to analysis periods.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3000
diff changeset
333
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
334 analysisPeriods = aPs.toArray(new DateRange[aPs.size()]);
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 for (int i = 0; i < analysisPeriods.length; ++i) {
3003
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
339 DateRange ap = analysisPeriods[i];
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
340 log.debug("analysis period " +
e5e6363e6cba FixA: Explicit model for date ranges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3001
diff changeset
341 ap.getFrom() + " - " + ap.getTo());
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
342 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
343 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
344
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
345 return analysisPeriods;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
346 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
347
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
348 public Boolean getPreprocessing() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
349 if (preprocessing == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
350 StateData sd = artifact.getData("preprocessing");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
351 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
352 log.warn("missing 'preprocessing'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
353 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
354 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
355 preprocessing = Boolean.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
356 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
357 return preprocessing;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
358 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
359
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
360 public String getFunction() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
361 if (function == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
362 StateData sd = artifact.getData("function");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
363 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
364 log.warn("missing 'function'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
365 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
366 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
367 function = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
368 }
2726
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
369 if (log.isDebugEnabled()) {
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
370 log.debug("function: " + function);
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
371 }
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
372 return function;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
373 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
374
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
375 public double [] getQs() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
376 if (qs == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
377 StateData sd = artifact.getData("qs");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
378 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
379 log.warn("missing 'qs'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
380 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
381 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
382 String [] parts = ((String)sd.getValue()).split("[\\s;]");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
383 TDoubleArrayList list = new TDoubleArrayList(parts.length);
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
384 for (String part: parts) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
385 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
386 list.add(Double.parseDouble(part));
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
387 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
388 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
389 log.warn("'" + part + "' is not numeric.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
390 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
391 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
392 qs = list.toNativeArray();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
393 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
394 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
395 log.debug("qs: " + Arrays.toString(qs));
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
396 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
397 return qs;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
398 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
399 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
400 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org