Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java @ 2220:f31d92060f21
Added reference curve facet type.
flys-artifacts/trunk@3860 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 01 Feb 2012 13:56:38 +0000 |
parents | 4b6e9b377a84 |
children | 4db19a88bddb |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import org.apache.log4j.Logger; import de.intevation.flys.model.Gauge; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class Calculation6 extends Calculation { private static final Logger logger = Logger.getLogger(Calculation6.class); private int mode; private int[] timerange; private double[] values; public static final int MODE_W = 0; public static final int MODE_Q = 1; public Calculation6(int mode, int[] timerange, double[] values) { this.mode = mode; this.timerange = timerange; this.values = values; } public CalculationResult calculate(Gauge gauge) { if (!checkParameters() || gauge == null) { logger.warn("Parameters not valid for calculation."); return null; } if (logger.isDebugEnabled()) { debug(); } logger.warn("TODO: IMPLEMENT ME"); return null; } protected boolean checkParameters() { if (!(mode == MODE_W || mode == MODE_Q)) { logger.warn("Invalid mode '" + mode + "' for calculation."); return false; } if (timerange == null || timerange.length < 2) { logger.warn("Invalid timerange for calculation."); return false; } if (values == null || values.length == 0) { logger.warn("No values for W or Q specified."); return false; } return true; } /** * Writes the parameters used for this calculation to logger. */ public void debug() { StringBuilder sb = new StringBuilder(); for (double value: values) { sb.append(String.valueOf(value) + " "); } logger.debug("========== Calculation6 =========="); logger.debug(" Mode: " + mode); logger.debug(" Timerange: " + timerange[0] + " - " + timerange[1]); logger.debug(" Input values: " + sb.toString()); logger.debug("=================================="); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :