[Dive4elements-commits] [PATCH 2 of 3] ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess

Wald Commits scm-commit at wald.intevation.org
Mon Jan 21 17:20:18 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1358784670 -3600
# Node ID f8217f1fef2eca1f2d9236e9db54e2f670b3dbd6
# Parent  d5d2faf14522560781d3bcc74d63ddd054503b31
ExtremeAccess, RangeAccess and callers: Refactored, moved getStep to RangeAccess.
Inherit from RangeAccess, adjusted constructor and callers.

diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java
--- 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);
     }
 
 
diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java
--- 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).
diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java
--- 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);
 
diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java
--- 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;
diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java
--- 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);
 
diff -r d5d2faf14522 -r f8217f1fef2e flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java
--- 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);


More information about the Dive4elements-commits mailing list