[PATCH 2 of 4] Add getFirstLastKM utiltity function to WQKms
Wald Commits
scm-commit at wald.intevation.org
Thu Jul 18 13:16:55 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1374146031 -7200
# Node ID 38ee580a30cb830fcfbb2e4950138368be6d8bea
# Parent ca56c4e6a755a808b9b55a293c2090664dbdfa5e
Add getFirstLastKM utiltity function to WQKms
I found this useful.
diff -r ca56c4e6a755 -r 38ee580a30cb artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java Thu Jul 18 13:12:39 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java Thu Jul 18 13:13:51 2013 +0200
@@ -143,5 +143,15 @@
double to = getKm(size()-1);
return from + " - " + to;
}
+
+ /**
+ * Returns an array of two double values the first and last kilometer.
+ *
+ * @return a double array with the first and last km
+ */
+ public double[] getFirstLastKM() {
+ /* Behold the first km might be larger then the last! */
+ return new double[] {getKm(0), getKm(size()-1)};
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
More information about the Dive4elements-commits
mailing list