changeset 706:ddd8b37d5cd3

Removed dead code. flys-artifacts/trunk@2158 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 18 Jun 2011 18:19:34 +0000
parents 853dceead0f4
children b6f57d927905
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 5 files changed, 12 insertions(+), 105 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sat Jun 18 17:03:17 2011 +0000
+++ b/flys-artifacts/ChangeLog	Sat Jun 18 18:19:34 2011 +0000
@@ -1,3 +1,11 @@
+2011-06-18  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java,
+	  src/main/java/de/intevation/flys/exports/WaterlevelExporter.java,
+	  src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  Removed dead code.
+
 2011-06-18  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/DataFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Sat Jun 18 17:03:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Sat Jun 18 18:19:34 2011 +0000
@@ -131,7 +131,7 @@
      *
      * @return the FLYSContext.
      */
-    protected FLYSContext getFlysContext(Object context) {
+    protected static FLYSContext getFlysContext(Object context) {
         return context instanceof FLYSContext
             ? (FLYSContext) context
             : (FLYSContext) ((CallContext) context).globalContext();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Sat Jun 18 17:03:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Sat Jun 18 18:19:34 2011 +0000
@@ -43,7 +43,6 @@
 import de.intevation.flys.artifacts.model.Calculation4;
 import de.intevation.flys.artifacts.model.Segment;
 
-import gnu.trove.TDoubleArrayList;
 
 /**
  * The default WINFO artifact.
@@ -85,13 +84,7 @@
             dumpArtifact();
         }
 
-        FLYSContext flysContext = null;
-        if (context instanceof FLYSContext) {
-            flysContext = (FLYSContext) context;
-        }
-        else {
-            flysContext = (FLYSContext) context.globalContext();
-        }
+        FLYSContext flysContext = getFlysContext(context);
 
         StateEngine stateEngine = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
@@ -338,8 +331,6 @@
         WQKms[] results = computeWaterlevelData(
             kms, qs, ws, wst, river.getKmUp());
 
-        // TODO Introduce a caching mechanism here!
-
         return results;
     }
 
@@ -405,8 +396,6 @@
             throw new NullPointerException("No Wst found for selected river.");
         }
 
-        // TODO Introduce a caching mechanism here!
-
         return computeDurationCurveData(g, wst, locations[0]);
     }
 
@@ -498,8 +487,6 @@
 
         WQKms wqkms = computeDischargeCurveData(wst, locations[0]);
 
-        // TODO Introduce a caching mechanism here!
-
         return wqkms;
     }
 
@@ -528,60 +515,6 @@
         return wqkms;
     }
 
-    private static final double [] getBounds(double [][] segments) {
-        boolean down = true;
-        double min =  Double.MAX_VALUE;
-        double max = -Double.MAX_VALUE;
-
-        for (double [] segment: segments) {
-            if (down = segment[0] > segment[1]) {
-                if (segment[1] < min) min = segment[1];
-                if (segment[0] > max) max = segment[0];
-            }
-            else {
-                if (segment[0] < min) min = segment[0];
-                if (segment[1] > max) max = segment[1];
-            }
-        }
-
-        return down
-            ?  new double [] { max, min }
-            :  new double [] { min, max };
-
-    }
-
-    protected static double [] extractBoundsKm(River river, double [][] segments) {
-
-        if (segments.length == 2) {
-            return getBounds(segments);
-        }
-
-        TDoubleArrayList bounds = new TDoubleArrayList();
-
-        bounds.add(Math.min(segments[0][0], segments[0][1]));
-
-        for (int i = 1; i < segments.length-1; ++i) {
-            double [] segment = segments[i];
-
-            Gauge gauge = river.determineGauge(segment[0], segment[1]);
-
-            if (gauge == null) {
-                logger.warn("no gauge found between " + 
-                    segment[0] + " and " + segment[1]);
-                bounds.add(0.5*(segment[0] + segment[1]));
-            }
-            else {
-                bounds.add(gauge.getStation().doubleValue());
-            }
-        }
-
-        bounds.add(Math.max(
-            segments[segments.length-1][0],
-            segments[segments.length-1][1]));
-
-        return bounds.toNativeArray();
-    }
-
     /**
      * Returns the data computed by the discharge longitudinal section
      * computation.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Sat Jun 18 17:03:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Sat Jun 18 18:19:34 2011 +0000
@@ -22,7 +22,7 @@
 import de.intevation.flys.model.River;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
-import de.intevation.flys.artifacts.WINFOArtifact;
+
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.WQKms;
 
@@ -215,23 +215,6 @@
 
 
     /**
-     * Returns the waterlevel data computed by the WINFOArtifact.
-     *
-     * @param artifact The WINFOArtifact.
-     *
-     * @return the computed waterlevel data.
-     */
-    protected WQKms[] getWaterlevelData(Artifact artifact) {
-        WINFOArtifact winfoArtifact = (WINFOArtifact) artifact;
-        WQKms[]       wqkms         = winfoArtifact.getWaterlevelData();
-
-        logger.debug("Got " + wqkms.length + " WQKms objects.");
-
-        return wqkms;
-    }
-
-
-    /**
      * Process the output for W facets in a longitudinal section curve.
      *
      * @param wqkms An array of WQKms values.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Sat Jun 18 17:03:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Sat Jun 18 18:19:34 2011 +0000
@@ -15,8 +15,8 @@
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 
-import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.WQKms;
+
 import de.intevation.flys.utils.Formatter;
 
 
@@ -85,23 +85,6 @@
     }
 
 
-    /**
-     * Returns the waterlevel data computed by the WINFOArtifact.
-     *
-     * @param artifact The WINFOArtifact.
-     *
-     * @return the computed waterlevel data.
-     */
-    protected WQKms[] getWaterlevelData(Artifact artifact) {
-        WINFOArtifact winfoArtifact = (WINFOArtifact) artifact;
-        WQKms[]       wqkms         = winfoArtifact.getWaterlevelData();
-
-        logger.debug("Got " + wqkms.length + " WQKms objects.");
-
-        return wqkms;
-    }
-
-
     @Override
     protected void writeCSVData(CSVWriter writer) {
         logger.info("WaterlevelExporter.writeData");

http://dive4elements.wald.intevation.org