[PATCH 01 of 12] Minor refactoring for future readability and refactoring

Wald Commits scm-commit at wald.intevation.org
Tue Nov 12 17:18:40 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1384166033 -3600
# Node ID 13876b523e33f746b2eae584a05341a6759729f8
# Parent  783b295c35d3a6d731e94210be17377fbbf80974
Minor refactoring for future readability and refactoring.

diff -r 783b295c35d3 -r 13876b523e33 artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Tue Nov 12 16:54:18 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Mon Nov 11 11:33:53 2013 +0100
@@ -43,16 +43,18 @@
             boolean          visible) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
-        if (data instanceof BedDiffYearResult) {
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-            StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
 
-            generator.addAxisSeries(series, axisName, visible);
+        if (!(data instanceof BedDiffYearResult)) {
+            // Should not happen if canHandle is correct
+            logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
-        // Should not happen if canHandle is correct
-        logger.error("Can't process " + data.getClass().getName() + " objects");
+
+        BedDiffYearResult bData = (BedDiffYearResult) data;
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
+
+        generator.addAxisSeries(series, axisName, visible);
     }
 
     @Override
@@ -65,16 +67,18 @@
     ) {
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
-        if (data instanceof BedDiffYearResult) {
-            BedDiffYearResult bData = (BedDiffYearResult) data;
-            XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
-            StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
 
-            generator.addAxisSeries(series, index, visible);
+        if (!(data instanceof BedDiffYearResult)) {
+            // Should not happen if canHandle is correct
+            logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
-        // Should not happen if canHandle is correct
-        logger.error("Can't process " + data.getClass().getName() + " objects");
+
+        BedDiffYearResult bData = (BedDiffYearResult) data;
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, bData.getHeightPerYearData(), false, GAP_TOLERANCE);
+
+        generator.addAxisSeries(series, index, visible);
     }
 
     @Override


More information about the Dive4elements-commits mailing list