changeset 7057:1011a40ee79c generator-refactoring

Add Default Processor implementation and make processors inherit it.
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 20 Sep 2013 09:55:17 +0200
parents 7056fa3b1f75
children 5c07024cdc24
files artifacts/src/main/java/org/dive4elements/river/exports/process/AnnotationProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/DefaultProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
diffstat 8 files changed, 55 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 =
--- 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);
--- 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);
--- 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);
--- /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;
+    }
+}
--- 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);
 
--- 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@intevation.de">Björn Ricks</a>
  */
-public class QOutProcessor implements Processor {
+public class QOutProcessor extends DefaultProcessor {
 
     /** Private logger. */
     private static final Logger logger =
--- 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@intevation.de">Björn Ricks</a>
  */
-public class WOutProcessor implements Processor {
+public class WOutProcessor extends DefaultProcessor {
 
     /** Private logger. */
     private static final Logger logger =

http://dive4elements.wald.intevation.org