[PATCH 19 of 45] (issue1754) Extend WKms interface for KM filtering
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 10 17:05:47 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1424096902 -3600
# Node ID 1cff4c98df7658a8a030658f6300c7d46b375ef9
# Parent 0011508d2f9d25aa0a2655ddd460e2ff95cbdf2b
(issue1754) Extend WKms interface for KM filtering
diff -r 0011508d2f9d -r 1cff4c98df76 artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKms.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKms.java Mon Feb 16 15:27:39 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKms.java Mon Feb 16 15:28:22 2015 +0100
@@ -21,6 +21,9 @@
TDoubleArrayList allKms();
+ /** A new list of values between the km's from and to. */
+ WKms filteredKms(double from, double to);
+
TDoubleArrayList allWs();
boolean guessWaterIncreasing();
diff -r 0011508d2f9d -r 1cff4c98df76 artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsImpl.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsImpl.java Mon Feb 16 15:27:39 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsImpl.java Mon Feb 16 15:28:22 2015 +0100
@@ -108,5 +108,17 @@
public TDoubleArrayList allWs() {
return ws;
}
+
+ @Override
+ public WKms filteredKms(double from, double to) {
+ WKmsImpl retval = new WKmsImpl(getName());
+ for (int i = 0; i < size(); i++) {
+ double km = kms.getQuick(i);
+ if (km >= from && km <= to) {
+ retval.add(ws.getQuick(i), km);
+ }
+ }
+ return retval;
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r 0011508d2f9d -r 1cff4c98df76 artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java Mon Feb 16 15:27:39 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java Mon Feb 16 15:28:22 2015 +0100
@@ -137,6 +137,18 @@
return qs;
}
+ @Override
+ public WKms filteredKms(double from, double to) {
+ WQKms retval = new WQKms(getName());
+ for (int i = 0; i < size(); i++) {
+ double km = kms.getQuick(i);
+ if (km >= from && km <= to) {
+ retval.add(ws.getQuick(i), qs.getQuick(i), km);
+ }
+ }
+ return retval;
+ }
+
public double[] getKms() {
return kms.toNativeArray();
}
More information about the Dive4Elements-commits
mailing list