view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQCKms.java @ 414:0385bcc4229a

Added subtitles to the available charts. flys-artifacts/trunk@1878 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 10 May 2011 12:19:17 +0000
parents eb22ffe4d74c
children 913b52064449
line wrap: on
line source
package de.intevation.flys.artifacts.model;

import gnu.trove.TDoubleArrayList;


/**
 * This class represents a pool of data triples that consists of 'W', 'Q' and
 * 'KM' data with corrected 'W' values computed by a BackJumpCorrector.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class WQCKms extends WQKms {

    protected TDoubleArrayList cw;


    public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) {
        super(kms, qs, ws);

        this.cw = new TDoubleArrayList(cws);
    }


    /**
     * Adds a new row to this data pool with corrected W.
     *
     * @param w a W.
     * @param q a Q.
     * @param kms a Kms.
     * @param cw The corrected W.
     */
    public void add(double w, double q, double kms, double cw) {
        add(w, q, kms);
        this.cw.add(cw);
    }


    /**
     * This method returns a 4dim array of W, Q,Kms and corrected W.
     *
     * @param idx The position of the triple.
     * @param dst destination array
     *
     * @return a 4dim array of [W, Q, Kms, CW] in dst.
     */
    public double[] get(int idx, double[] dst) {
        dst = super.get(idx, dst);

        if (dst.length < 4) {
            return dst;
        }

        if (cw != null && cw.size() > idx) {
            dst[3] = cw.get(idx);
        }

        return dst;
    }


    /**
     * Returns the double array of corrected W values.
     *
     * @return the double array of corrected W values.
     */
    public double[] getCWs() {
        return cw.toNativeArray();
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org