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

FixA: Created a common base class for the fixing related calculations. flys-artifacts/trunk@5072 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 16:35:14 +0000
parents
children 1a636be7612b
comparison
equal deleted inserted replaced
3418:21c1d1d25919 3419:da7cf0e3ccaa
1 package de.intevation.flys.artifacts.model.fixings;
2
3 import de.intevation.flys.artifacts.access.FixAccess;
4
5 import de.intevation.flys.artifacts.model.Calculation;
6
7 import org.apache.log4j.Logger;
8
9 public class FixCalculation
10 extends Calculation
11 {
12 private static Logger log = Logger.getLogger(FixCalculation.class);
13
14 protected String river;
15 protected double from;
16 protected double to;
17 protected double step;
18 protected boolean preprocessing;
19 protected String function;
20 protected int [] events;
21 protected int qSectorStart;
22 protected int qSectorEnd;
23
24 public FixCalculation() {
25 }
26
27 public FixCalculation(FixAccess access) {
28 String river = access.getRiver();
29 Double from = access.getFrom();
30 Double to = access.getTo();
31 Double step = access.getStep();
32 String function = access.getFunction();
33 int [] events = access.getEvents();
34 Integer qSectorStart = access.getQSectorStart();
35 Integer qSectorEnd = access.getQSectorEnd();
36 Boolean preprocessing = access.getPreprocessing();
37
38 if (river == null) {
39 addProblem("fix.missing.river");
40 }
41
42 if (from == null) {
43 addProblem("fix.missing.from");
44 }
45
46 if (to == null) {
47 addProblem("fix.missing.to");
48 }
49
50 if (step == null) {
51 addProblem("fix.missing.step");
52 }
53
54 if (function == null) {
55 addProblem("fix.missing.function");
56 }
57
58 if (events == null || events.length < 1) {
59 addProblem("fix.missing.events");
60 }
61
62 if (qSectorStart == null) {
63 addProblem("fix.missing.qstart.sector");
64 }
65
66 if (qSectorEnd == null) {
67 addProblem("fix.missing.qend.sector");
68 }
69
70 if (preprocessing == null) {
71 addProblem("fix.missing.preprocessing");
72 }
73
74 if (!hasProblems()) {
75 this.river = river;
76 this.from = from;
77 this.to = to;
78 this.step = step;
79 this.function = function;
80 this.events = events;
81 this.qSectorStart = qSectorStart;
82 this.qSectorEnd = qSectorEnd;
83 this.preprocessing = preprocessing;
84 }
85
86 }
87 }
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org