changeset 4050:975f608dd254

Cleaned up iterating over maps. Removed some dead code.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 06 Oct 2012 12:27:01 +0200
parents 8e66293c5369
children 58bdf95df5e4
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WSPLGENCalculation.java flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java
diffstat 7 files changed, 21 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/ChangeLog	Sat Oct 06 12:27:01 2012 +0200
@@ -1,3 +1,13 @@
+2012-10-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java,
+	  src/main/java/de/intevation/flys/artifacts/model/map/WSPLGENCalculation.java,
+	  src/main/java/de/intevation/flys/collections/CollectionAttribute.java,
+	  src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Cleaned up iterating over maps. Removed some dead code.
+
 2012-10-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Sat Oct 06 12:27:01 2012 +0200
@@ -1041,12 +1041,11 @@
      */
     @Override
     public String hash() {
-        Set<Map.Entry<String, StateData>> entries = data.entrySet();
 
         long hash  = 0L;
         int  shift = 3;
 
-        for (Map.Entry<String, StateData> entry: entries) {
+        for (Map.Entry<String, StateData> entry: data.entrySet()) {
             String key   = entry.getKey();
             Object value = entry.getValue().getValue();
 
@@ -1450,9 +1449,8 @@
 
     protected void debugFacets() {
         log.debug("######### FACETS #########");
-        Set<Map.Entry<String, List<Facet>>> entries = facets.entrySet();
 
-        for (Map.Entry<String, List<Facet>> entry: entries) {
+        for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) {
             String out = entry.getKey();
             List<Facet> fs = entry.getValue();
             for (Facet f: fs) {
@@ -1472,8 +1470,7 @@
             return;
         }
 
-        Set<Map.Entry<String, List<Facet>>> entries = filterFacets.entrySet();
-        for (Map.Entry<String, List<Facet>> entry: entries) {
+        for (Map.Entry<String, List<Facet>> entry: filterFacets.entrySet()) {
             String      out     = entry.getKey();
             List<Facet> filters = entry.getValue();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/CrossSectionApp.java	Sat Oct 06 12:27:01 2012 +0200
@@ -398,17 +398,12 @@
 
     protected void updateChart() {
 
-        CrossSectionLineItem csli =
-            (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem();
-
         JFreeChart chart = createChart();
 
         chartPanel.setChart(chart);
     }
 
     protected ChartPanel createChartPanel() {
-        CrossSectionLineItem csli =
-            (CrossSectionLineItem)crossSectionLinesCB.getSelectedItem();
 
         JFreeChart chart = createChart();
 
@@ -552,8 +547,6 @@
 
         DefaultXYDataset dataset = new DefaultXYDataset();
 
-        XYSeries series = new XYSeries(legend, false);
-
         dataset.addSeries(legend, values);
 
         StableXYDifferenceRenderer renderer =
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WSPLGENCalculation.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WSPLGENCalculation.java	Sat Oct 06 12:27:01 2012 +0200
@@ -2,7 +2,6 @@
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -54,9 +53,7 @@
         Element root = document.createElement("problems");
 
         if (numErrors() > 0) {
-            Set<Map.Entry<Integer, String>> entrySet = errors.entrySet();
-
-            for (Map.Entry<Integer, String> entry: entrySet) {
+            for (Map.Entry<Integer, String> entry: errors.entrySet()) {
                 Element problem = document.createElement("problem");
                 problem.setAttribute("error", String.valueOf(entry.getKey()));
                 problem.setTextContent(entry.getValue());
@@ -66,9 +63,7 @@
         }
 
         if (numWarnings() > 0) {
-            Set<Map.Entry<Integer, String>> entrySet = warnings.entrySet();
-
-            for (Map.Entry<Integer, String> entry: entrySet) {
+            for (Map.Entry<Integer, String> entry: warnings.entrySet()) {
                 Element problem = document.createElement("problem");
                 problem.setAttribute("error", String.valueOf(entry.getKey()));
                 problem.setTextContent(entry.getValue());
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java	Sat Oct 06 12:27:01 2012 +0200
@@ -4,7 +4,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -65,8 +64,7 @@
 
         List<String> removeUs = new ArrayList<String>();
 
-        Set<Map.Entry<String, Output>> entries = outputMap.entrySet();
-        for (Map.Entry<String, Output> entry: entries) {
+        for (Map.Entry<String, Output> entry: outputMap.entrySet()) {
             Output o = entry.getValue();
 
             List<Facet> facets = o.getFacets();
@@ -222,9 +220,7 @@
             return allFacets;
         }
 
-        Set<String> outputNames = outputMap.keySet();
-
-        for (String outputName: outputNames) {
+        for (String outputName: outputMap.keySet()) {
             allFacets.addAll(getFacets(outputName));
         }
 
@@ -242,9 +238,7 @@
 
         Element outputsEl = ec.create("outputs");
 
-        Set<Map.Entry<String, Output>> entrySet = outputMap.entrySet();
-
-        for (Map.Entry<String, Output> entry: entrySet) {
+        for (Map.Entry<String, Output> entry: outputMap.entrySet()) {
             appendOutput(outputsEl, entry.getKey(), entry.getValue());
         }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Sat Oct 06 12:27:01 2012 +0200
@@ -6,7 +6,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import javax.xml.xpath.XPathConstants;
 
@@ -257,9 +256,8 @@
             return modified;
         }
 
-        Set<Map.Entry<String, Output>> entries = outputMap.entrySet();
 
-        for (Map.Entry<String, Output> entry: entries) {
+        for (Map.Entry<String, Output> entry: outputMap.entrySet()) {
             String outName = entry.getKey();
             Output output  = entry.getValue();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Sat Oct 06 11:57:10 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Sat Oct 06 12:27:01 2012 +0200
@@ -24,7 +24,6 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.log4j.Logger;
 import org.jfree.chart.annotations.XYTextAnnotation;
@@ -363,10 +362,9 @@
         NumberFormat nf = NumberFormat.getInstance(locale);
 
         List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
-        Set<Map.Entry<Integer, int[]>> entries = annoIdxMap.entrySet();
 
-        for(Map.Entry<Integer, int[]> entry : entries) {
-            int[] idxs = entry.getValue();
+        for (int[] idxs: annoIdxMap.values()) {
+
             double x = tsc.getXValue(idxs[0], idxs[1]);
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(

http://dive4elements.wald.intevation.org