Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation5.java @ 2204:45f7762767e2
Bugfix: use correct order of parameters to call DefaultStateData constructor.
flys-artifacts/trunk@3828 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 13:23:40 +0000 |
parents | 4e3bfa2d9584 |
children | dd93a8e1377a |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.ArrayList; import org.apache.log4j.Logger; public class Calculation5 extends Calculation { private static Logger log = Logger.getLogger(Calculation5.class); protected double startKm; protected double [] endKms; public Calculation5() { } public Calculation5(double startKm, double [] endKms) { this.startKm = startKm; this.endKms = endKms; } public CalculationResult calculate(WstValueTable wst) { ArrayList<WW> results = new ArrayList<WW>(); int numProblems = numProblems(); for (double endKm: endKms) { double [][] wws = wst.relateWs(startKm, endKm, this); int newNumProblems = numProblems(); if (wws.length == 2) { WW ww = new WW( generateName(startKm, endKm), startKm, wws[0], endKm, wws[1]); if (newNumProblems > numProblems) { ww.removeNaNs(); } results.add(ww); } numProblems = newNumProblems; } return new CalculationResult( results.toArray(new WW[results.size()]), this); } protected static String generateName(double startKm, double endKm) { // TODO: I18N return "W(km " + startKm + ") ~ W(km " + endKm + ")"; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :