sascha@676: package de.intevation.flys.artifacts.model; sascha@676: sascha@676: import org.apache.log4j.Logger; sascha@676: sascha@676: public class Calculation3 sascha@676: extends Calculation sascha@676: { sascha@676: private static Logger logger = Logger.getLogger(Calculation3.class); sascha@676: sascha@676: protected double km; sascha@676: protected int [] days; sascha@676: protected double [] qs; sascha@676: sascha@676: public Calculation3() { sascha@676: } sascha@676: sascha@676: public Calculation3(double km, int [] days, double [] qs) { sascha@676: this.km = km; sascha@676: this.days = days; sascha@676: this.qs = qs; sascha@676: } sascha@676: sascha@709: public CalculationResult calculate(WstValueTable wst) { sascha@676: sascha@676: double [] ws = wst.interpolateW(km, qs, new double[qs.length], this); sascha@676: ingo@1669: if (days == null || days.length == 0) { sascha@2166: addProblem(km, "cannot.find.ds"); ingo@1669: } ingo@1669: ingo@1669: if (logger.isDebugEnabled()) { ingo@1669: logger.debug("Calculate duration curve data:"); ingo@1669: logger.debug(" km : " + km); ingo@1669: logger.debug(" num Days : " + (days != null ? days.length : 0)); ingo@1669: logger.debug(" num Qs : " + (qs != null ? qs.length : 0)); ingo@1669: logger.debug(" result Ws: " + (ws != null ? ws.length : 0)); ingo@1669: } ingo@1669: sascha@676: WQDay wqday = new WQDay(days, ws, qs); sascha@676: sascha@676: if (hasProblems()) { sascha@676: logger.debug("calculation caused "+numProblems()+" problem(s)."); sascha@676: wqday.removeNaNs(); sascha@676: } sascha@676: sascha@709: return new CalculationResult(wqday, this); sascha@676: } sascha@676: } sascha@676: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :