sascha@2271: package de.intevation.flys.artifacts.model;
sascha@2271: 
sascha@2271: import de.intevation.flys.artifacts.math.Identity;
sascha@2271: 
sascha@2271: import gnu.trove.TDoubleArrayList;
sascha@2271: 
sascha@2271: public class WWQQ
sascha@2271: extends      WW
sascha@2271: {
sascha@2271:     public static class ApplyFunctionIterator
sascha@2271:     extends             WW.ApplyFunctionIterator
sascha@2271:     {
sascha@2271:         public ApplyFunctionIterator(WWQQ ww) {
sascha@2271:             super(ww, Identity.IDENTITY, Identity.IDENTITY);
sascha@2271:         }
sascha@2271: 
sascha@2271:         @Override
sascha@2271:         public void get(int idx, double [] wwqqPair) {
sascha@2271:             WWQQ wwqq = (WWQQ)ww;
sascha@2271:             wwqqPair[0] = function1.value(wwqq.getW(idx));
sascha@2271:             wwqqPair[1] = function2.value(wwqq.getW2(idx));
sascha@2271:             wwqqPair[2] = wwqq.getQ1(idx);
sascha@2271:             wwqqPair[3] = wwqq.getQ2(idx);
sascha@2271:         }
sascha@2271:     } // class ApplyFunctionIterator
sascha@2271: 
sascha@2271:     protected TDoubleArrayList qs1;
sascha@2271:     protected TDoubleArrayList qs2;
sascha@2271: 
sascha@2271:     public WWQQ() {
sascha@2271:         this("");
sascha@2271:     }
sascha@2271: 
sascha@2271:     public WWQQ(String name) {
sascha@2271:         super(name);
sascha@2271:     }
sascha@2271: 
sascha@2271:     public WWQQ(int capacity) {
sascha@2271:         this(capacity, "");
sascha@2271:     }
sascha@2271: 
sascha@2271:     public WWQQ(int capacity, String name) {
sascha@2271:         super(capacity, name);
sascha@2271:     }
sascha@2271: 
sascha@2271:     public WWQQ(
sascha@3076:         String    name,
sascha@2271:         double    startKm,
sascha@2271:         Double    startDatum,
sascha@2271:         double [] ws1,
sascha@2271:         double [] qs1,
sascha@2271:         double    endKm,
sascha@2271:         Double    endDatum,
sascha@2271:         double [] ws2,
sascha@2271:         double [] qs2
sascha@2271:     ) {
sascha@2271:         super(name, startKm, startDatum, ws1, endKm, endDatum, ws2);
sascha@2271:         this.qs1 = new TDoubleArrayList(qs1);
sascha@2271:         this.qs2 = new TDoubleArrayList(qs2);
sascha@2271:     }
sascha@2271: 
sascha@2271:     public double getQ1(int idx) {
sascha@2271:         return qs1.getQuick(idx);
sascha@2271:     }
sascha@2271: 
sascha@2271:     public double getQ2(int idx) {
sascha@2271:         return qs2.getQuick(idx);
sascha@2271:     }
sascha@2271: 
sascha@2271:     public double [] getQs1() {
sascha@2271:         return qs1.toNativeArray();
sascha@2271:     }
sascha@2271: 
sascha@2271:     public double [] getQs2() {
sascha@2271:         return qs2.toNativeArray();
sascha@2271:     }
sascha@2271: 
sascha@2271:     @Override
sascha@2271:     public double [] get(int idx) {
sascha@2271:         return get(idx, new double[4]);
sascha@2271:     }
sascha@2271: 
sascha@2271:     @Override
sascha@2271:     public double [] get(int idx, double [] dst) {
sascha@2271:         dst[0] = ws .getQuick(idx);
sascha@2271:         dst[1] = ws2.getQuick(idx);
sascha@2271:         dst[2] = qs1.getQuick(idx);
sascha@2271:         dst[3] = qs2.getQuick(idx);
sascha@2271:         return dst;
sascha@2271:     }
sascha@2271: 
sascha@2271:     @Override
sascha@2271:     public void removeNaNs() {
sascha@2271:         removeNaNs(new TDoubleArrayList [] { ws, ws2, qs1, qs2 });
sascha@2271:     }
sascha@2271: }
sascha@2271: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :