Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation2.java @ 697:b972eba2ed8a facets-slt
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
flys-artifacts/branches/facets-slt@2143 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 17 Jun 2011 10:40:54 +0000 |
parents | 3dc61e00385e |
children | 3b7e9ddf6bb1 |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.Arrays; import org.apache.log4j.Logger; public class Calculation2 extends Calculation { private static Logger logger = Logger.getLogger(Calculation2.class); protected double km; public Calculation2() { } public Calculation2(double km) { this.km = km; } public WQKms calculate(WstValueTable wst) { logger.debug("Calculation2.calculate"); double [][] wqs = wst.interpolateWQ(km, this); if (wqs == null || wqs[0].length == 0) { logger.debug("Cannot compute discharge curve data."); return null; } double [] ws = wqs[0]; double [] qs = wqs[1]; double [] kms = new double[ws.length]; Arrays.fill(kms, km); WQKms wqkms = new WQKms(kms, qs, ws, String.valueOf(km)); if (hasProblems()) { logger.debug("found + "+numProblems()+" problems."); wqkms.removeNaNs(); } return wqkms; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :