diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 2701:c553d4fa3957

Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact. flys-artifacts/trunk@4417 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 16 May 2012 08:21:02 +0000
parents e8fc770d2f8c
children 64dc2997b2dd
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Tue May 15 15:31:39 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java	Wed May 16 08:21:02 2012 +0000
@@ -196,8 +196,9 @@
                 getDataAsInt("wst_id"));
         }
 
+        Double tmp = getDataAsDouble("ld_locations");
         double [][] vs = interpolator.interpolateWQColumnwise(
-            getDataAsDouble("ld_locations"));
+            tmp != null ? tmp : 0);
 
         for (int x = 0; x < vs[1].length; x++) {
             logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]);
@@ -223,21 +224,6 @@
 
 
     /**
-     * Get a DataItem casted to double (0 if fails).
-     */
-    public double getDataAsDouble(String dataName) {
-        String val = getDataAsString(dataName);
-        try {
-            return Double.valueOf(val);
-        }
-        catch (NumberFormatException e) {
-            logger.warn("Could not get data " + dataName + " as double", e);
-            return 0;
-        }
-    }
-
-
-    /**
      * Get the "current" state (there is but one).
      * @param cc ignored.
      * @return the "current" (only possible) state.

http://dive4elements.wald.intevation.org