changeset 727:11e9489eb1a7

WQDay is based on WQ now to make it exportable as AT. flys-artifacts/trunk@2217 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 23 Jun 2011 12:39:59 +0000
parents cbaa3ca86f2f
children 56bcf56b1fe0
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQDay.java
diffstat 2 files changed, 20 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jun 23 12:19:12 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jun 23 12:39:59 2011 +0000
@@ -1,3 +1,8 @@
+2011-06-23  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WQDay.java:
+	  Based on WQ now to make it exportable as AT.
+
 2011-06-23  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WQ.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQDay.java	Thu Jun 23 12:19:12 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQDay.java	Thu Jun 23 12:39:59 2011 +0000
@@ -1,95 +1,66 @@
 package de.intevation.flys.artifacts.model;
 
-import java.io.Serializable;
-
-import gnu.trove.TDoubleArrayList;
 import gnu.trove.TIntArrayList;
 
-
 /**
  * This class represents a pool of data triples that consists of 'W', 'Q' and
  * 'Day' data.
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class WQDay implements Serializable {
-
+public class WQDay
+extends      WQ
+{
     protected TIntArrayList days;
 
-    protected TDoubleArrayList ws;
-
-    protected TDoubleArrayList qs;
-
-
     public WQDay() {
+        super("");
         days = new TIntArrayList();
-        ws   = new TDoubleArrayList();
-        qs   = new TDoubleArrayList();
     }
 
-
     public WQDay(int capacity) {
         days = new TIntArrayList(capacity);
-        ws   = new TDoubleArrayList(capacity);
-        qs   = new TDoubleArrayList(capacity);
     }
 
     public WQDay(int [] days, double [] ws, double [] qs) {
+        super(qs, ws, "");
         this.days = new TIntArrayList(days);
-        this.ws   = new TDoubleArrayList(ws);
-        this.qs   = new TDoubleArrayList(qs);
     }
 
 
     public void add(int day, double w, double q) {
+        super.add(w, q);
         days.add(day);
-        ws.add(w);
-        qs.add(q);
     }
 
-
-    public int size() {
-        return days.size();
-    }
-
-
     public int getDay(int idx) {
         return days.getQuick(idx);
     }
 
-
-    public double getW(int idx) {
-        return ws.getQuick(idx);
-    }
-
-
-    public double getQ(int idx) {
-        return qs.getQuick(idx);
-    }
-
+    @Override
     public void removeNaNs() {
 
         int dest = 0;
-        int N = ws.size();
+        int N = w.size();
 
         for (int i = 0; i < N; ++i) {
-            double w = ws.getQuick(i);
-            double q = qs.getQuick(i);
+            double wi = w.getQuick(i);
+            double qi = q.getQuick(i);
 
-            if (Double.isNaN(w) || Double.isNaN(q)) {
+            if (Double.isNaN(wi) || Double.isNaN(qi)) {
                 continue;
             }
 
             days.setQuick(dest, days.getQuick(i));
-            ws.setQuick(dest, w);
-            qs.setQuick(dest, q);
+            w.setQuick(dest, wi);
+            q.setQuick(dest, qi);
             ++dest;
         }
 
         if (dest < N) {
             days.remove(dest, N-dest);
-            ws  .remove(dest, N-dest);
-            qs  .remove(dest, N-dest);
+            w   .remove(dest, N-dest);
+            q   .remove(dest, N-dest);
         }
     }
 }

http://dive4elements.wald.intevation.org