[Dive4elements-commits] [PATCH 03 of 10] ExtremeAccess: Added helper method to find the values for (the range of) a km

Wald Commits scm-commit at wald.intevation.org
Wed Oct 31 14:09:03 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351687514 -3600
# Node ID 2d3f8af87b7b53d3cf581a5aeb0e14152baa416c
# Parent  0545002e112c5222357b794f5246e0b7683f5483
ExtremeAccess: Added helper method to find the values for (the range of) a km.

diff -r 0545002e112c -r 2d3f8af87b7b flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Wed Oct 31 13:44:36 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Wed Oct 31 13:45:14 2012 +0100
@@ -112,6 +112,22 @@
         return function;
     }
 
+
+    /** Find first RangeWithValues for which the given location
+     * is within the range and return its values.
+     * @return values of first suitable rangewithvalues or null.
+     */
+    public double[] getValuesForRange(double location) {
+        logger.debug("ExtemeAcces.getValuesForRange");
+        for (RangeWithValues rangeValues: getRanges()) {
+            if (rangeValues.inside(location)) {
+                return rangeValues.getValues();
+            }
+        }
+        return null;
+    }
+
+
     public List<RangeWithValues> getRanges() {
 
         if (ranges == null) {


More information about the Dive4elements-commits mailing list