[Dive4elements-commits] [PATCH] Added QKms model

Wald Commits scm-commit at wald.intevation.org
Mon Jan 21 12:24:04 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1358767436 -3600
# Node ID 4d457c68b1d3ba1f9617052bb3c6d7ed1523034c
# Parent  846b0441f90567e40111957571e75f4a4fafad0f
Added QKms model.

diff -r 846b0441f905 -r 4d457c68b1d3 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKms.java
--- /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 :
diff -r 846b0441f905 -r 4d457c68b1d3 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKmsImpl.java
--- /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;
+    }
+}
diff -r 846b0441f905 -r 4d457c68b1d3 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKms.java
--- 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 :
diff -r 846b0441f905 -r 4d457c68b1d3 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKms.java
--- 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();
     }


More information about the Dive4elements-commits mailing list