ingo@446: package de.intevation.flys.artifacts.model; ingo@446: ingo@446: import gnu.trove.TDoubleArrayList; ingo@446: ingo@446: ingo@446: /** ingo@446: * A model class that is used to store a line of a WST. ingo@446: * ingo@446: * @author Ingo Weinzierl ingo@446: */ ingo@446: public class WstLine { ingo@446: ingo@446: /** The kilometer value of the line.*/ ingo@446: protected double km; ingo@446: ingo@446: /** The W values.*/ ingo@446: protected TDoubleArrayList ws; ingo@446: ingo@446: /** The Q values.*/ ingo@446: protected TDoubleArrayList qs; ingo@446: ingo@446: ingo@446: /** ingo@446: * A constructor that builds a new WstLine for a specific kilometer. ingo@446: * ingo@446: * @param km The kilometer. ingo@446: */ ingo@446: public WstLine(double km) { ingo@446: this.km = km; ingo@446: this.ws = new TDoubleArrayList(); ingo@446: this.qs = new TDoubleArrayList(); ingo@446: } ingo@446: ingo@446: ingo@446: /** ingo@446: * Adds a pair of W/Q to this line. ingo@446: * ingo@446: * @param w The W value. ingo@446: * @param q The Q value. ingo@446: */ ingo@446: public void add(double w, double q) { ingo@446: ws.add(w); ingo@446: qs.add(q); ingo@446: } ingo@446: ingo@446: ingo@446: /** ingo@446: * Returns the kilometer of this line. ingo@446: * ingo@446: * @return the kilomter of this line. ingo@446: */ ingo@446: public double getKm() { ingo@446: return km; ingo@446: } ingo@446: ingo@446: ingo@446: /** ingo@446: * Returns the W value at index idx of this line. ingo@446: * ingo@446: * @param idx The position of the desired W value. ingo@446: * ingo@446: * @return the W at position idx. ingo@446: */ ingo@446: public double getW(int idx) { ingo@446: return ws.size() > idx ? ws.get(idx) : -1d; ingo@446: } ingo@446: ingo@446: ingo@446: /** ingo@446: * Returns the Q values of this line. ingo@446: * ingo@446: * @return the Q values of this line. ingo@446: */ ingo@446: public double[] getQs() { ingo@446: return qs.toNativeArray(); ingo@446: } ingo@446: ingo@446: ingo@446: /** ingo@446: * Returns the number of columns this line consists of. ingo@446: * ingo@446: * @return the columns this line consists of. ingo@446: */ ingo@446: public int getSize() { ingo@446: return qs.size(); ingo@446: } ingo@446: } ingo@446: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :