changeset 4817:4d457c68b1d3

Added QKms model.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 21 Jan 2013 12:23:56 +0100
parents 846b0441f905
children 650b75f6669a 243f1eb02b95
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKms.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKmsImpl.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java
diffstat 4 files changed, 101 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKms.java	Mon Jan 21 12:23:56 2013 +0100
@@ -0,0 +1,18 @@
+package de.intevation.flys.artifacts.model;
+
+import gnu.trove.TDoubleArrayList;
+
+public interface QKms
+extends          NamedObject
+{
+    int size();
+
+    double getKm(int index);
+
+    double getQ(int index);
+
+    TDoubleArrayList allKms();
+
+    TDoubleArrayList allQs();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKmsImpl.java	Mon Jan 21 12:23:56 2013 +0100
@@ -0,0 +1,76 @@
+package de.intevation.flys.artifacts.model;
+
+import gnu.trove.TDoubleArrayList;
+
+public class QKmsImpl
+extends      NamedObjectImpl
+implements   QKms
+{
+    protected TDoubleArrayList kms;
+    protected TDoubleArrayList qs;
+
+    public QKmsImpl() {
+        super("");
+        kms = new TDoubleArrayList();
+        qs  = new TDoubleArrayList();
+    }
+
+    public QKmsImpl(String name) {
+        super(name);
+        kms = new TDoubleArrayList();
+        qs  = new TDoubleArrayList();
+    }
+
+
+    public QKmsImpl(int capacity) {
+        super("");
+        kms = new TDoubleArrayList(capacity);
+        qs  = new TDoubleArrayList(capacity);
+    }
+
+
+    public QKmsImpl(TDoubleArrayList kms, TDoubleArrayList qs) {
+        this(kms, qs, "");
+    }
+
+    public QKmsImpl(
+        TDoubleArrayList kms,
+        TDoubleArrayList qs,
+        String           name
+    ) {
+        super(name);
+        this.kms = kms;
+        this.qs  = qs;
+    }
+
+    public void add(double km, double q) {
+        kms.add(km);
+        qs .add(q);
+    }
+
+    @Override
+    public double getQ(int index) {
+        return qs.getQuick(index);
+    }
+
+
+    @Override
+    public double getKm(int index) {
+        return kms.getQuick(index);
+    }
+
+    @Override
+    public int size() {
+        return kms.size();
+    }
+
+    @Override
+    public TDoubleArrayList allKms() {
+        return kms;
+    }
+
+    @Override
+    public TDoubleArrayList allQs() {
+        return qs;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java	Mon Jan 21 10:37:40 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java	Mon Jan 21 12:23:56 2013 +0100
@@ -15,6 +15,6 @@
 
     TDoubleArrayList allWs();
 
-    public boolean guessWaterIncreasing();
+    boolean guessWaterIncreasing();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java	Mon Jan 21 10:37:40 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java	Mon Jan 21 12:23:56 2013 +0100
@@ -13,7 +13,7 @@
  */
 public class WQKms
 extends      WQ
-implements   WKms
+implements   WKms, QKms
 {
     private static Logger logger = Logger.getLogger(WQKms.class);
 
@@ -105,6 +105,11 @@
         return ws;
     }
 
+    @Override
+    public TDoubleArrayList allQs() {
+        return qs;
+    }
+
     public double[] getKms() {
         return kms.toNativeArray();
     }

http://dive4elements.wald.intevation.org