[PATCH 1 of 2] Extracted method

Wald Commits scm-commit at wald.intevation.org
Wed Dec 11 11:21:09 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1386754751 -3600
# Node ID 2f7a01fdb0931c5ca33e3e217c8460b34016570b
# Parent  4e76bfff5fa647a7f00719fffa918e4a57bf0b40
Extracted method.

diff -r 4e76bfff5fa6 -r 2f7a01fdb093 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java	Tue Dec 10 11:22:06 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java	Wed Dec 11 10:39:11 2013 +0100
@@ -101,31 +101,8 @@
             return;
         }
 
-        if (getXBounds(0) != null && getDomainAxisRange() != null) {
-            Bounds bounds =
-                calculateZoom(getXBounds(0), getDomainAxisRange());
-            context.putContextValue("startkm", bounds.getLower());
-            context.putContextValue("endkm", bounds.getUpper());
-        }
-        else if (getXBounds(0) != null && getDomainAxisRange() == null) {
-            context.putContextValue("startkm", getXBounds(0).getLower());
-            context.putContextValue("endkm", getXBounds(0).getUpper());
-        }
-        else if (getXBounds(0) == null && getDomainAxisRange() == null) {
-            D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
-            context.putContextValue("startkm", access.getLowerKM());
-            context.putContextValue("endkm", access.getUpperKM());
-        }
-        else if (getXBounds(0) == null && getDomainAxisRange() != null){
-            D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
-            Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
-            Bounds bounds =
-                calculateZoom(b, getDomainAxisRange());
-            context.putContextValue("startkm", bounds.getLower());
-            context.putContextValue("endkm", bounds.getUpper());
-        }
+        setContextBoundsEpoch(bundle);
+
         Processor processor = new KMIndexProcessor();
         Processor woutp = new WOutProcessor();
         if (name.equals(BED_DIFFERENCE_EPOCH)) {
@@ -179,6 +156,34 @@
         }
     }
 
+    protected void setContextBoundsEpoch(ArtifactAndFacet bundle) {
+        if (getXBounds(0) != null && getDomainAxisRange() != null) {
+            Bounds bounds =
+                calculateZoom(getXBounds(0), getDomainAxisRange());
+            context.putContextValue("startkm", bounds.getLower());
+            context.putContextValue("endkm", bounds.getUpper());
+        }
+        else if (getXBounds(0) != null && getDomainAxisRange() == null) {
+            context.putContextValue("startkm", getXBounds(0).getLower());
+            context.putContextValue("endkm", getXBounds(0).getUpper());
+        }
+        else if (getXBounds(0) == null && getDomainAxisRange() == null) {
+            D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            context.putContextValue("startkm", access.getLowerKM());
+            context.putContextValue("endkm", access.getUpperKM());
+        }
+        else if (getXBounds(0) == null && getDomainAxisRange() != null){
+            D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
+            Bounds bounds =
+                calculateZoom(b, getDomainAxisRange());
+            context.putContextValue("startkm", bounds.getLower());
+            context.putContextValue("endkm", bounds.getUpper());
+        }
+    }
+
     @Override
     protected String getDefaultChartTitle() {
         return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);


More information about the Dive4elements-commits mailing list