Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation3.java @ 3318:dbe2f85bf160
merged flys-artifacts/2.8
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:35 +0200 |
parents | 2898b1ff6013 |
children |
comparison
equal
deleted
inserted
replaced
2987:98c7a46ec5ae | 3318:dbe2f85bf160 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 public class Calculation3 | |
6 extends Calculation | |
7 { | |
8 private static Logger logger = Logger.getLogger(Calculation3.class); | |
9 | |
10 protected double km; | |
11 protected int [] days; | |
12 protected double [] qs; | |
13 | |
14 public Calculation3() { | |
15 } | |
16 | |
17 public Calculation3(double km, int [] days, double [] qs) { | |
18 this.km = km; | |
19 this.days = days; | |
20 this.qs = qs; | |
21 } | |
22 | |
23 public CalculationResult calculate(WstValueTable wst) { | |
24 | |
25 double [] ws = wst.interpolateW(km, qs, new double[qs.length], this); | |
26 | |
27 if (days == null || days.length == 0) { | |
28 addProblem(km, "cannot.find.ds"); | |
29 } | |
30 | |
31 if (logger.isDebugEnabled()) { | |
32 logger.debug("Calculate duration curve data:"); | |
33 logger.debug(" km : " + km); | |
34 logger.debug(" num Days : " + (days != null ? days.length : 0)); | |
35 logger.debug(" num Qs : " + (qs != null ? qs.length : 0)); | |
36 logger.debug(" result Ws: " + (ws != null ? ws.length : 0)); | |
37 } | |
38 | |
39 WQDay wqday = new WQDay(days, ws, qs); | |
40 | |
41 if (hasProblems()) { | |
42 logger.debug("calculation caused "+numProblems()+" problem(s)."); | |
43 wqday.removeNaNs(); | |
44 } | |
45 | |
46 return new CalculationResult(wqday, this); | |
47 } | |
48 } | |
49 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |