Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.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 | e3c7a3228bc2 |
children | 7f7ab030a4e3 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java Thu Jul 19 15:44:14 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisCalculation.java Thu Jul 19 16:35:14 2012 +0000 @@ -5,7 +5,6 @@ import de.intevation.flys.artifacts.math.fitting.Function; import de.intevation.flys.artifacts.math.fitting.FunctionFactory; -import de.intevation.flys.artifacts.model.Calculation; import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.model.DateRange; import de.intevation.flys.artifacts.model.FixingsColumn; @@ -42,64 +41,23 @@ import org.apache.log4j.Logger; public class FixAnalysisCalculation -extends Calculation +extends FixCalculation { private static Logger log = Logger.getLogger(FixAnalysisCalculation.class); public static final double EPSILON = 1e-4; - protected String river; - protected double from; - protected double to; - protected double step; - protected boolean preprocessing; - protected String function; - protected int [] events; protected DateRange referencePeriod; protected DateRange [] analysisPeriods; - protected int qSectorStart; - protected int qSectorEnd; public FixAnalysisCalculation() { } public FixAnalysisCalculation(FixAnalysisAccess access) { + super(access); - String river = access.getRiver(); - Double from = access.getFrom(); - Double to = access.getTo(); - Double step = access.getStep(); - String function = access.getFunction(); - int [] events = access.getEvents(); DateRange referencePeriod = access.getReferencePeriod(); DateRange [] analysisPeriods = access.getAnalysisPeriods(); - Integer qSectorStart = access.getQSectorStart(); - Integer qSectorEnd = access.getQSectorEnd(); - Boolean preprocessing = access.getPreprocessing(); - - if (river == null) { - addProblem("fix.missing.river"); - } - - if (from == null) { - addProblem("fix.missing.from"); - } - - if (to == null) { - addProblem("fix.missing.to"); - } - - if (step == null) { - addProblem("fix.missing.step"); - } - - if (function == null) { - addProblem("fix.missing.function"); - } - - if (events == null || events.length < 1) { - addProblem("fix.missing.events"); - } if (referencePeriod == null) { addProblem("fix.missing.reference.period"); @@ -109,30 +67,9 @@ addProblem("fix.missing.analysis.periods"); } - if (qSectorStart == null) { - addProblem("fix.missing.qstart.sector"); - } - - if (qSectorEnd == null) { - addProblem("fix.missing.qend.sector"); - } - - if (preprocessing == null) { - addProblem("fix.missing.preprocessing"); - } - if (!hasProblems()) { - this.river = river; - this.from = from; - this.to = to; - this.step = step; - this.function = function; - this.events = events; this.referencePeriod = referencePeriod; this.analysisPeriods = analysisPeriods; - this.qSectorStart = qSectorStart; - this.qSectorEnd = qSectorEnd; - this.preprocessing = preprocessing; } }