ingo@361: package de.intevation.flys.artifacts.model; ingo@361: ingo@361: import java.io.Serializable; ingo@365: ingo@365: import gnu.trove.TDoubleArrayList; ingo@361: ingo@361: ingo@361: /** ingo@361: * This class represents a pool of data triples that consists of 'W', 'Q' and ingo@361: * 'KM' data. ingo@361: * ingo@361: * @author Ingo Weinzierl ingo@361: */ ingo@361: public class WQKms implements Serializable { ingo@361: ingo@361: /** The array that contains the 'W' values.*/ ingo@365: protected TDoubleArrayList w; ingo@361: ingo@361: /** The array that contains the 'Q' values.*/ ingo@365: protected TDoubleArrayList q; ingo@361: ingo@361: /** The array that contains the 'KMs' values.*/ ingo@365: protected TDoubleArrayList kms; ingo@361: ingo@361: ingo@361: public WQKms() { ingo@365: this.w = new TDoubleArrayList(); ingo@365: this.q = new TDoubleArrayList(); ingo@365: this.kms = new TDoubleArrayList(); ingo@361: } ingo@361: sascha@380: public WQKms(int capacity) { sascha@380: this.w = new TDoubleArrayList(capacity); sascha@380: this.q = new TDoubleArrayList(capacity); sascha@380: this.kms = new TDoubleArrayList(capacity); sascha@380: } sascha@380: ingo@361: ingo@361: /** ingo@361: * Adds a new row to this data pool. ingo@361: * ingo@361: * @param w a W. ingo@361: * @param q a Q. ingo@361: * @param kms a Kms. ingo@361: */ ingo@361: public void add(double w, double q, double kms) { ingo@365: this.w.add(w); ingo@365: this.q.add(q); ingo@365: this.kms.add(kms); ingo@361: } ingo@361: ingo@361: ingo@361: /** ingo@367: * Returns the number of triples stored in this data pool. ingo@361: * ingo@367: * @return the number of triples stored in this data pool. ingo@361: */ ingo@367: public int size() { ingo@367: return kms.size(); sascha@366: } sascha@366: sascha@366: /** sascha@366: * This method returns a triple of W, Q and Kms in a single 3dim array. sascha@366: * sascha@366: * @param idx The position of the triple. sascha@366: * @param dst destination array sascha@366: * sascha@366: * @return a triple of [W, Q, Kms] in dst. sascha@366: */ sascha@366: public double[] get(int idx, double [] dst) { sascha@366: dst[0] = w .get(idx); sascha@366: dst[1] = q .get(idx); sascha@366: dst[2] = kms.get(idx); sascha@366: return dst; ingo@361: } ingo@367: ingo@367: ingo@367: public double getKms(int idx) { ingo@367: return kms.get(idx); ingo@367: } ingo@361: } ingo@361: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :