ingo@402: package de.intevation.flys.artifacts.model; ingo@402: ingo@402: import gnu.trove.TDoubleArrayList; ingo@402: ingo@402: ingo@402: /** ingo@402: * This class represents a pool of data triples that consists of 'W', 'Q' and ingo@402: * 'KM' data with corrected 'W' values computed by a BackJumpCorrector. ingo@402: * ingo@402: * @author Ingo Weinzierl ingo@402: */ ingo@402: public class WQCKms extends WQKms { ingo@402: ingo@402: protected TDoubleArrayList cw; ingo@402: sascha@655: public WQCKms() { sascha@655: } sascha@655: sascha@655: public WQCKms(WQKms other, double [] cws) { sascha@655: this.w = other.w; sascha@655: this.q = other.q; sascha@655: this.kms = other.kms; sascha@655: this.cw = new TDoubleArrayList(cws); sascha@655: } sascha@655: ingo@402: ingo@402: public WQCKms(double[] kms, double[] qs, double[] ws, double[] cws) { ingo@402: super(kms, qs, ws); ingo@402: ingo@402: this.cw = new TDoubleArrayList(cws); ingo@402: } ingo@402: sascha@675: @Override sascha@675: public void removeNaNs() { sascha@675: removeNaNs(new TDoubleArrayList [] { w, q, cw, kms }); sascha@675: } sascha@675: ingo@402: ingo@402: /** ingo@402: * Adds a new row to this data pool with corrected W. ingo@402: * ingo@402: * @param w a W. ingo@402: * @param q a Q. ingo@402: * @param kms a Kms. ingo@402: * @param cw The corrected W. ingo@402: */ ingo@402: public void add(double w, double q, double kms, double cw) { ingo@402: add(w, q, kms); ingo@402: this.cw.add(cw); ingo@402: } ingo@402: ingo@402: ingo@402: /** ingo@402: * This method returns a 4dim array of W, Q,Kms and corrected W. ingo@402: * ingo@402: * @param idx The position of the triple. ingo@402: * @param dst destination array ingo@402: * ingo@402: * @return a 4dim array of [W, Q, Kms, CW] in dst. ingo@402: */ ingo@402: public double[] get(int idx, double[] dst) { ingo@402: dst = super.get(idx, dst); ingo@402: ingo@402: if (dst.length < 4) { ingo@402: return dst; ingo@402: } ingo@402: ingo@402: if (cw != null && cw.size() > idx) { ingo@402: dst[3] = cw.get(idx); ingo@402: } ingo@402: ingo@402: return dst; ingo@402: } ingo@402: ingo@402: ingo@402: /** ingo@402: * Returns the double array of corrected W values. ingo@402: * ingo@402: * @return the double array of corrected W values. ingo@402: */ ingo@402: public double[] getCWs() { ingo@402: return cw.toNativeArray(); ingo@402: } ingo@402: } ingo@402: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :