changeset 4825:f8217f1fef2e

ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess. Inherit from RangeAccess, adjusted constructor and callers.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 21 Jan 2013 17:11:10 +0100
parents d5d2faf14522
children a3dc382bc1ca
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java
diffstat 6 files changed, 26 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Mon Jan 21 17:11:10 2013 +0100
@@ -1,5 +1,7 @@
 package de.intevation.flys.artifacts.access;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 import de.intevation.flys.artifacts.model.RangeWithValues;
@@ -13,15 +15,11 @@
 
 /** Access data used for extreme value analysis. */
 public class ExtremeAccess
-extends      RiverAccess
+extends      RangeAccess
 {
     /** Our private logger. */
     private static Logger logger = Logger.getLogger(ExtremeAccess.class);
 
-    protected Double from;
-    protected Double to;
-    protected Double step;
-
     protected Long start;
     protected Long end;
 
@@ -32,57 +30,8 @@
     protected List<RangeWithValues> ranges;
 
 
-    public ExtremeAccess() {
-    }
-
-
-    public ExtremeAccess(FLYSArtifact artifact) {
-        super(artifact);
-    }
-
-
-    /** From (km) for calculation. */
-    public Double getFrom() {
-
-        if (from == null) {
-            from = getDouble("ld_from");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("from: '" + from + "'");
-        }
-
-        return from;
-    }
-
-
-    /** To (km) for calculation. */
-    public Double getTo() {
-
-        if (to == null) {
-            to = getDouble("ld_to");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("to: '" + to + "'");
-        }
-
-        return to;
-    }
-
-
-    /** Step width for calculation. */
-    public Double getStep() {
-
-        if (step == null) {
-            step = getDouble("ld_step");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("step: '" + step + "'");
-        }
-
-        return step;
+    public ExtremeAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java	Mon Jan 21 17:11:10 2013 +0100
@@ -19,6 +19,8 @@
 
     Double to;
 
+    Double step;
+
 
     public RangeAccess(FLYSArtifact artifact, CallContext context) {
         super(artifact);
@@ -45,6 +47,21 @@
     }
 
 
+    /** Step width for calculation. */
+    public Double getStep() {
+
+        if (step == null) {
+            step = getDouble("ld_step");
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("step: '" + step + "'");
+        }
+
+        return step;
+    }
+
+
     /**
      * Get min and max kilometer, independent of parametization
      * (ld_from/to vs ld_locations).
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java	Mon Jan 21 17:11:10 2013 +0100
@@ -87,7 +87,7 @@
                 logger.debug("A curve at km = " + currentKm);
                 Curve c = curveEntry.getValue();
                 // Find segment in which the curr. km is located.
-                ExtremeAccess access = new ExtremeAccess(flys);
+                ExtremeAccess access = new ExtremeAccess(flys, context);
 
                 double[] ds = access.getValuesForRange(currentKm);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Mon Jan 21 17:11:10 2013 +0100
@@ -53,7 +53,7 @@
 
         CalculationResult res;
 
-        ExtremeAccess access = new ExtremeAccess(artifact);
+        ExtremeAccess access = new ExtremeAccess(artifact, context);
 
         if (old instanceof CalculationResult) {
             res = (CalculationResult)old;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java	Mon Jan 21 17:11:10 2013 +0100
@@ -78,7 +78,7 @@
 
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
 
-        ExtremeAccess access = new ExtremeAccess(flysArtifact);
+        ExtremeAccess access = new ExtremeAccess(flysArtifact, context);
         River river = RiverFactory.getRiver(access.getRiver());
         WstValueTable wstValueTable = WstValueTableFactory.getTable(river);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Mon Jan 21 17:00:16 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Mon Jan 21 17:11:10 2013 +0100
@@ -54,7 +54,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        BedQualityAccess access = new BedQualityAccess(artifact);
+        BedQualityAccess access = new BedQualityAccess(artifact, context);
 
         CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
             : new BedQualityCalculation().calculate(access);

http://dive4elements.wald.intevation.org