comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java @ 3159:a6a3f9894fe0

FixA: I18N flys-artifacts/trunk@4771 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 24 Jun 2012 17:44:39 +0000
parents 368d1837ce5d
children cd8d81b2824d
comparison
equal deleted inserted replaced
3158:0e8929d5e9e3 3159:a6a3f9894fe0
75 Integer qSectorStart = access.getQSectorStart(); 75 Integer qSectorStart = access.getQSectorStart();
76 Integer qSectorEnd = access.getQSectorEnd(); 76 Integer qSectorEnd = access.getQSectorEnd();
77 Boolean preprocessing = access.getPreprocessing(); 77 Boolean preprocessing = access.getPreprocessing();
78 78
79 if (river == null) { 79 if (river == null) {
80 // TODO: i18n
81 addProblem("fix.missing.river"); 80 addProblem("fix.missing.river");
82 } 81 }
83 82
84 if (from == null) { 83 if (from == null) {
85 // TODO: i18n
86 addProblem("fix.missing.from"); 84 addProblem("fix.missing.from");
87 } 85 }
88 86
89 if (to == null) { 87 if (to == null) {
90 // TODO: i18n
91 addProblem("fix.missing.to"); 88 addProblem("fix.missing.to");
92 } 89 }
93 90
94 if (step == null) { 91 if (step == null) {
95 // TODO: i18n
96 addProblem("fix.missing.step");
97 } 92 }
98 93
99 if (function == null) { 94 if (function == null) {
100 // TODO: i18n
101 addProblem("fix.missing.function");
102 } 95 }
103 96
104 if (events == null || events.length < 1) { 97 if (events == null || events.length < 1) {
105 // TODO: i18n
106 addProblem("fix.missing.events"); 98 addProblem("fix.missing.events");
107 } 99 }
108 100
109 if (referencePeriod == null) { 101 if (referencePeriod == null) {
110 // TODO: i18n
111 addProblem("fix.missing.reference.period"); 102 addProblem("fix.missing.reference.period");
112 } 103 }
113 104
114 if (analysisPeriods == null || analysisPeriods.length < 1) { 105 if (analysisPeriods == null || analysisPeriods.length < 1) {
115 // TODO: i18n
116 addProblem("fix.missing.analysis.periods"); 106 addProblem("fix.missing.analysis.periods");
117 } 107 }
118 108
119 if (qSectorStart == null) { 109 if (qSectorStart == null) {
120 // TODO: i18n
121 addProblem("fix.missing.qstart.sector"); 110 addProblem("fix.missing.qstart.sector");
122 } 111 }
123 112
124 if (qSectorEnd == null) { 113 if (qSectorEnd == null) {
125 // TODO: i18n
126 addProblem("fix.missing.qend.sector"); 114 addProblem("fix.missing.qend.sector");
127 } 115 }
128 116
129 if (preprocessing == null) { 117 if (preprocessing == null) {
130 // TODO: i18n
131 addProblem("fix.missing.preprocessing"); 118 addProblem("fix.missing.preprocessing");
132 } 119 }
133 120
134 if (!hasProblems()) { 121 if (!hasProblems()) {
135 this.river = river; 122 this.river = river;
159 146
160 Function func = FunctionFactory.getInstance() 147 Function func = FunctionFactory.getInstance()
161 .getFunction(function); 148 .getFunction(function);
162 149
163 if (func == null) { 150 if (func == null) {
164 // TODO: i18n
165 addProblem("fix.invalid.function.name"); 151 addProblem("fix.invalid.function.name");
166 } 152 }
167 153
168 if (hasProblems()) { 154 if (hasProblems()) {
169 return new CalculationResult(this); 155 return new CalculationResult(this);
170 } 156 }
171 157
172 final List<Column> eventColumns = getEventColumns(overview); 158 final List<Column> eventColumns = getEventColumns(overview);
173 159
174 if (eventColumns.size() < 2) { 160 if (eventColumns.size() < 2) {
175 // TODO: i18n
176 addProblem("fix.too.less.data.columns"); 161 addProblem("fix.too.less.data.columns");
177 return new CalculationResult(this); 162 return new CalculationResult(this);
178 } 163 }
179 164
180 double [] kms = DoubleUtil.explode(from, to, step / 1000.0); 165 double [] kms = DoubleUtil.explode(from, to, step / 1000.0);
239 224
240 fitting.reset(); 225 fitting.reset();
241 226
242 if (!fitting.fit(qs, ws)) { 227 if (!fitting.fit(qs, ws)) {
243 ++numFailed; 228 ++numFailed;
244 // TODO: i18n
245 addProblem(km, "fix.fitting.failed"); 229 addProblem(km, "fix.fitting.failed");
246 continue; 230 continue;
247 } 231 }
248 232
249 referenced.add(km, fitting.referencedToArray()); 233 referenced.add(km, fitting.referencedToArray());
266 log.debug("success: " + (kms.length - numFailed)); 250 log.debug("success: " + (kms.length - numFailed));
267 log.debug("failed: " + numFailed); 251 log.debug("failed: " + numFailed);
268 } 252 }
269 253
270 if (invalid) { 254 if (invalid) {
271 // TODO: i18n
272 addProblem("fix.invalid.values"); 255 addProblem("fix.invalid.values");
273 results.removeNaNs(); 256 results.removeNaNs();
274 } 257 }
275 258
276 KMIndex<AnalysisPeriod []> analysisPeriods = 259 KMIndex<AnalysisPeriod []> analysisPeriods =
305 288
306 for (Fixing.Column meta: metas) { 289 for (Fixing.Column meta: metas) {
307 290
308 FixingsColumn data = fcf.getColumnData(meta); 291 FixingsColumn data = fcf.getColumnData(meta);
309 if (data == null) { 292 if (data == null) {
310 // TODO: i18n
311 addProblem("fix.cannot.load.data"); 293 addProblem("fix.cannot.load.data");
312 } 294 }
313 else { 295 else {
314 columns.add(new Column(meta, data)); 296 columns.add(new Column(meta, data));
315 } 297 }
324 Parameters parameters, 306 Parameters parameters,
325 FixingsOverview overview 307 FixingsOverview overview
326 ) { 308 ) {
327 Range range = new Range(from, to); 309 Range range = new Range(from, to);
328 310
329 int kmIndex = parameters.columnIndex("km"); 311 int kmIndex = parameters.columnIndex("km");
330 int maxQIndex = parameters.columnIndex("max_q"); 312 int maxQIndex = parameters.columnIndex("max_q");
331 313
332 ColumnCache cc = new ColumnCache(); 314 ColumnCache cc = new ColumnCache();
333 315
334 double [] wq = new double[2]; 316 double [] wq = new double[2];

http://dive4elements.wald.intevation.org