[PATCH] There ist no need to format a number as a string and then re-parse it to double to get its double value. Just take the double value!

Wald Commits scm-commit at wald.intevation.org
Wed Oct 1 12:01:50 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1412157706 -7200
# Node ID 1c732c88a2d6f7f1c9306a196f619c7ea4e754e0
# Parent  31272d799dad9d19413e347856581e54609e32da
There ist no need to format a number as a string and then re-parse it to double to get its double value. Just take the double value!

diff -r 31272d799dad -r 1c732c88a2d6 artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Wed Oct 01 11:07:52 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java	Wed Oct 01 12:01:46 2014 +0200
@@ -84,7 +84,7 @@
         if (!(pnpObject instanceof Number)) {
             return new WQKms(kms, values[0], values[1], name, W.CENTIMETER_AT_GAUGE);
         }
-        double pnp = Double.valueOf(pnpObject.toString());
+        double pnp = ((Number)pnpObject).doubleValue();
         double[] ws = transformToM(values[1], pnp);
 
         return new WQKms(kms, values[0], ws, name);


More information about the Dive4Elements-commits mailing list