[PATCH] Removed redundant lookup for km in call context

Wald Commits scm-commit at wald.intevation.org
Fri Nov 1 11:50:16 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1383303011 -3600
# Node ID 3e9961dcbf9aac880954a89c051b30afd68a16d9
# Parent  1890bd524d270434df3534c544909ff21c0f208a
Removed redundant lookup for km in call context.

diff -r 1890bd524d27 -r 3e9961dcbf9a artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java	Thu Oct 31 21:56:04 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java	Fri Nov 01 11:50:11 2013 +0100
@@ -115,8 +115,9 @@
             // Do we have a current km in context?
             // If so, we are likely fetching data for a navigable
             // diagram (i.e. in fixation branch).
-            if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) {
-                Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM);
+            Object xkm = context.getContextValue(FixChartGenerator.CURRENT_KM);
+            if (xkm != null) {
+                Double ckm = (Double)xkm;
                 // Return linearly interpolated values, in m if not at gauge,
                 // in cm if at gauge.
                 qs = mvArtifact.getMainValuesQ(new double[] {ckm});
diff -r 1890bd524d27 -r 3e9961dcbf9a artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Thu Oct 31 21:56:04 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Fri Nov 01 11:50:11 2013 +0100
@@ -112,8 +112,9 @@
             // Do we have a current km in context?
             // If so, we are likely fetching data for a navigable
             // diagram (i.e. in fixation branch).
-            if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) {
-                Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM);
+            Object xkm = context.getContextValue(FixChartGenerator.CURRENT_KM);
+            if (xkm != null) {
+                Double ckm = (Double)xkm;
                 // Return linearly interpolated values, in m if not at gauge,
                 // in cm over datum if at gauge.
                 ws = mvArtifact.getMainValuesW(new double[] {ckm});


More information about the Dive4elements-commits mailing list