[PATCH 1 of 3] Add Default Processor implementation and make processors inherit it

Wald Commits scm-commit at wald.intevation.org
Fri Sep 20 10:30:09 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1379663717 -7200
# Branch generator-refactoring
# Node ID 1011a40ee79c28e70247b9f330328e67f51be066
# Parent  7056fa3b1f75c9968a51ee10872758403d37aa06
Add Default Processor implementation and make processors inherit it.

diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/AnnotationProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/AnnotationProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/AnnotationProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -23,7 +23,7 @@
  * Add data to chart/generator.
  *
  */
-public class AnnotationProcessor implements Processor {
+public class AnnotationProcessor extends DefaultProcessor {
 
     /** Private logger. */
     private static final Logger logger =
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -21,7 +21,7 @@
 import org.dive4elements.river.themes.ThemeDocument;
 
 
-public class BedDiffHeightYearProcessor implements Processor, FacetTypes {
+public class BedDiffHeightYearProcessor extends DefaultProcessor implements FacetTypes {
 
     private final static Logger logger =
             Logger.getLogger(BedDiffHeightYearProcessor.class);
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -21,7 +21,7 @@
 import org.dive4elements.river.themes.ThemeDocument;
 
 
-public class BedDiffYearProcessor implements Processor, FacetTypes {
+public class BedDiffYearProcessor extends DefaultProcessor implements FacetTypes {
 
     private final static Logger logger =
             Logger.getLogger(BedDiffYearProcessor.class);
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -21,7 +21,7 @@
 import org.dive4elements.river.model.BedHeightSingleValue;
 import org.dive4elements.river.themes.ThemeDocument;
 
-public class BedheightProcessor implements Processor {
+public class BedheightProcessor extends DefaultProcessor {
 
     private final static Logger logger =
             Logger.getLogger(BedheightProcessor.class);
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/DefaultProcessor.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/DefaultProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -0,0 +1,48 @@
+/* Copyright (C) 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.exports.process;
+
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.river.exports.XYChartGenerator;
+import org.dive4elements.river.themes.ThemeDocument;
+
+/** Dummy implementation for the Processor interface.
+ */
+public class DefaultProcessor implements Processor {
+
+    /**
+     * Processes data to generate e.g. a chart.
+     *
+     * @param generator XYChartGenerator to add output on.
+     * @param aandf       The artifact and facet
+     * @param theme      The theme that contains styling information.
+     * @param visible       The visibility of the curve.
+     * @param index        The index of the curve
+     */
+    public void doOut(
+            XYChartGenerator generator,
+            ArtifactAndFacet aandf,
+            ThemeDocument    theme,
+            boolean          visible,
+            int              indexu)
+    {
+        return;
+    }
+
+    /**
+     * Returns true if the Processor class is able to generate output for a facet type
+     *
+     * @param facettype Name of the facet type
+     * @return true if the facettype can be processed
+     */
+    public boolean canHandle(String facettype)
+    {
+        return false;
+    }
+}
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -22,7 +22,7 @@
 import org.dive4elements.river.themes.ThemeDocument;
 import org.dive4elements.river.utils.KMIndex;
 
-public class KMIndexProcessor implements Processor {
+public class KMIndexProcessor extends DefaultProcessor {
 
     private static final Logger logger = Logger.getLogger(KMIndexProcessor.class);
 
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -28,7 +28,7 @@
  *
  * @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
  */
-public class QOutProcessor implements Processor {
+public class QOutProcessor extends DefaultProcessor {
 
     /** Private logger. */
     private static final Logger logger =
diff -r 7056fa3b1f75 -r 1011a40ee79c artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Thu Sep 19 11:50:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Fri Sep 20 09:55:17 2013 +0200
@@ -27,7 +27,7 @@
  *
  * @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
  */
-public class WOutProcessor implements Processor {
+public class WOutProcessor extends DefaultProcessor {
 
     /** Private logger. */
     private static final Logger logger =


More information about the Dive4elements-commits mailing list