annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java @ 2877:f0a67bc0e777 2.7

merged flys-backend/2.7
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:31 +0200
parents f53173a8736b
children 3dd1c320cf81
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.util.Arrays;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import de.intevation.artifactdatabase.data.StateData;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import gnu.trove.TDoubleArrayList;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.utils.FLYSUtils;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 public class FixationArtifactAccess
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 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
16
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 protected FLYSArtifact artifact;
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 protected String river;
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 String calculationMode;
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 Double from;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 protected Double to;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 protected Double step;
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 Long start;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 protected Long end;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 protected Integer qSectorStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 protected Integer qSectorEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 protected Long referenceStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 protected Long referenceEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 protected long [][] analysisPeriods;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 protected int [] events;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 protected Boolean preprocessing;
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 String function;
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 double [] qs;
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 public FixationArtifactAccess() {
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 public FixationArtifactAccess(FLYSArtifact artifact) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 this.artifact = artifact;
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 FLYSArtifact getArtifact() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 return 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 String getRiver() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 if (river == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 StateData sd = artifact.getData("river");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 log.warn("missing 'river' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 river = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 log.debug("river: '" + river + "'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 return river;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 public String getCalculationMode() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 if (calculationMode == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 StateData sd = artifact.getData("calculation.mode");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 log.warn("missing 'calculation.mode' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 calculationMode = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 log.debug("calculationMode: '" + calculationMode + "'");
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 return calculationMode;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 public Double getFrom() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 if (from == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 StateData sd = artifact.getData("from");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 log.warn("missing 'from' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 from = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 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
101 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 log.debug("from: '" + from + "'");
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 return from;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 }
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 public Double getTo() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 if (to == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 StateData sd = artifact.getData("to");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 log.warn("missing 'to' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 to = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 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
124 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 log.debug("to: '" + to + "'");
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 return to;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 }
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 public Double getStep() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 if (step == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137 StateData sd = artifact.getData("step");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139 log.warn("missing 'step' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 step = Double.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 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
147 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151 log.debug("step: '" + step + "'");
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 return step;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155 }
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 public Long getStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 if (start == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
160 StateData sd = artifact.getData("start");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
161 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
162 log.warn("missing 'start' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
163 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
166 start = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
167 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
168 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
169 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
170 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
173 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174 log.debug("start: '" + start + "'");
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 return start;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 }
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 public Long getEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 if (end == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183 StateData sd = artifact.getData("end");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185 log.warn("missing 'end' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
187 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189 end = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 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
193 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 log.debug("end: '" + end + "'");
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 return end;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 }
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 public Integer getQSectorStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 if (qSectorStart == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 StateData sd = artifact.getData("q1");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 log.warn("missing 'q1' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212 qSectorStart = Integer.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 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
216 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219 return qSectorStart;
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 public Integer getQSectorEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
223
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 if (qSectorEnd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
225 StateData sd = artifact.getData("q2");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227 log.warn("missing 'q2' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231 qSectorEnd = Integer.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
232 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
233 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
234 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
235 }
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
238 return qSectorEnd;
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 public int [] getEvents() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
242 if (events == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
243 StateData sd = artifact.getData("events");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
244 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
245 log.warn("missing 'events' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
246 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
247 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
248 events = FLYSUtils.intArrayFromString((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
249 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
250 return events;
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
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
253 public Long getReferenceStart() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
254 if (referenceStart == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
255 StateData sd = artifact.getData("ref_start");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
256 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
257 log.warn("missing 'ref_start' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
258 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
259 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
260 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261 referenceStart = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264 log.warn("ref_start '"
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 + sd.getValue() + "' is not an integer.");
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 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
270 log.debug("referenceStart: '" + referenceStart + "'");
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 return referenceStart;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 }
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 public Long getReferenceEnd() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277 if (referenceEnd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
278 StateData sd = artifact.getData("ref_end");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 log.warn("missing 'ref_end' value");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
282 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
283 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
284 referenceEnd = Long.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 log.warn("ref_end '"
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
288 + sd.getValue() + "' is not an integer.");
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 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293 log.debug("referenceEnd: '" + referenceEnd + "'");
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 return referenceEnd;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 }
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 public long [][] getAnalysisPeriods() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 if (analysisPeriods == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301 /** TODO: Use real arrays here! */
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
302 StateData sdStart = artifact.getData("ana_start");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 StateData sdEnd = artifact.getData("ana_end");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
304
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
305 if (sdStart == null || sdEnd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306 log.warn("missing 'ana_start' or 'ana_end'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
309
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
310 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
311 analysisPeriods = new long [][] {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
312 { Long.parseLong((String)sdStart.getValue()),
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
313 Long.parseLong((String)sdEnd.getValue()) }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
314 };
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
315 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
316 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
317 log.warn("'ana_start' or 'ana_end' is not an integer.");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
318 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
319 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
320 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323 for (int i = 0; i < analysisPeriods.length; ++i) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
324 long [] ap = analysisPeriods[i];
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
325 log.debug("analysis period " + ap[0] + " - " + ap[1]);
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
326 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
327 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
328
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
329 return analysisPeriods;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
330 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 public Boolean getPreprocessing() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333 if (preprocessing == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334 StateData sd = artifact.getData("preprocessing");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336 log.warn("missing 'preprocessing'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339 preprocessing = Boolean.valueOf((String)sd.getValue());
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
340 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 return preprocessing;
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 public String getFunction() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
345 if (function == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
346 StateData sd = artifact.getData("function");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
347 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
348 log.warn("missing 'function'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
349 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
350 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
351 function = (String)sd.getValue();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
352 }
2726
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
353 if (log.isDebugEnabled()) {
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
354 log.debug("function: " + function);
f53173a8736b Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2725
diff changeset
355 }
2725
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
356 return function;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
357 }
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 public double [] getQs() {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
360 if (qs == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
361 StateData sd = artifact.getData("qs");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
362 if (sd == null) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
363 log.warn("missing 'qs'");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
364 return null;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
365 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
366 String [] parts = ((String)sd.getValue()).split("[\\s;]");
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
367 TDoubleArrayList list = new TDoubleArrayList(parts.length);
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
368 for (String part: parts) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
369 try {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
370 list.add(Double.parseDouble(part));
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
371 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
372 catch (NumberFormatException nfe) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
373 log.warn("'" + part + "' is not numeric.");
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 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
376 qs = list.toNativeArray();
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
377 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
378 if (log.isDebugEnabled()) {
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
379 log.debug("qs: " + Arrays.toString(qs));
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
380 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
381 return qs;
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
382 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
383 }
8dbc86a0948d Fixing analysis: Access to state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
384 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org