changeset 8757:bd17bd07db69

Remove further indirection in WINFOArtifact.
author Tom Gottfried <tom@intevation.de>
date Fri, 26 Jun 2015 14:31:08 +0200
parents 26dedebbe39f
children d4caab3fedde
files artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java
diffstat 2 files changed, 8 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Wed Jun 24 15:49:23 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jun 26 14:31:08 2015 +0200
@@ -782,19 +782,6 @@
 
 
     /**
-     * Determines the selected mode of distance/range input.
-     *
-     * Compatibility wrapper around RangeAccess.
-     *
-     * @return true, if the range mode is selected otherwise false.
-     */
-    public boolean isRange() {
-        RangeAccess rangeAccess = new RangeAccess(this);
-        return rangeAccess.isRange();
-    }
-
-
-    /**
      * Returns the selected distance based on a given range (from, to).
      *
      * @param dFrom The StateData that contains the lower value.
@@ -816,8 +803,8 @@
      * @return the selected kms.
      */
     public double[] getKms() {
-        if (isRange()) {
-            RangeAccess rangeAccess = new RangeAccess(this);
+        RangeAccess rangeAccess = new RangeAccess(this);
+        if (rangeAccess.isRange()) {
             return rangeAccess.getKmSteps();
         }
         else {
@@ -827,10 +814,10 @@
 
 
     public double [] getFromToStep() {
-        if (!isRange()) {
+        RangeAccess rangeAccess = new RangeAccess(this);
+        if (!rangeAccess.isRange()) {
             return null;
         }
-        RangeAccess rangeAccess = new RangeAccess(this);
         double [] fromTo = rangeAccess.getKmRange();
 
         if (fromTo == null) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java	Wed Jun 24 15:49:23 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java	Fri Jun 26 14:31:08 2015 +0200
@@ -32,6 +32,8 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.WINFOArtifact;
 
+import org.dive4elements.river.artifacts.access.RangeAccess;
+
 import org.dive4elements.river.artifacts.model.WstFactory;
 import org.dive4elements.river.artifacts.model.WstValueTable;
 import org.dive4elements.river.artifacts.model.WstValueTableFactory;
@@ -430,7 +432,7 @@
         double[] minmaxW = null;
         if(valueTable != null) {
             double[] km = null;
-            if(winfo.isRange()) {
+            if(new RangeAccess(winfo).isRange()) {
                 km = winfo.getFromToStep();
                 // Use the start km to determine the min max values.
                 minmaxW = valueTable.getMinMaxW(km[0]);
@@ -493,7 +495,7 @@
         double[] minmaxQ = null;
         if(valueTable != null) {
             double[] km = null;
-            if(winfo.isRange()) {
+            if(new RangeAccess(winfo).isRange()) {
                 km = winfo.getFromToStep();
                 minmaxQ = valueTable.getMinMaxQ(km[0], km[1], km[2]);
             }

http://dive4elements.wald.intevation.org