ingo@402: package de.intevation.flys.artifacts.model; ingo@402: ingo@402: import gnu.trove.TDoubleArrayList; 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: */ sascha@2182: public class WQCKms sascha@2182: extends WQKms sascha@2182: { sascha@2182: protected TDoubleArrayList cws; ingo@402: sascha@655: public WQCKms() { sascha@655: } sascha@655: sascha@655: public WQCKms(WQKms other, double [] cws) { sascha@2182: this.ws = other.ws; sascha@2182: this.qs = other.qs; sascha@655: this.kms = other.kms; sascha@2182: this.cws = 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: sascha@2182: this.cws = new TDoubleArrayList(cws); ingo@402: } ingo@402: ingo@686: @Override ingo@686: public void removeNaNs() { sascha@2182: removeNaNs(new TDoubleArrayList [] { ws, qs, cws, kms }); ingo@686: } ingo@686: 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) { sascha@2182: super.add(w, q, kms); sascha@2182: cws.add(cw); ingo@402: } ingo@402: sascha@2182: @Override sascha@2182: public double[] get(int idx) { sascha@2182: return get(idx, new double[4]); sascha@2182: } 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@686: @Override 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: sascha@2182: if (cws != null && cws.size() > idx) { sascha@2182: dst[3] = cws.getQuick(idx); ingo@402: } ingo@402: ingo@402: return dst; ingo@402: } ingo@402: sascha@719: public double getC(int idx) { sascha@2182: return cws.getQuick(idx); sascha@719: } sascha@719: 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() { sascha@2182: return cws.toNativeArray(); ingo@402: } ingo@402: } ingo@402: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :