changeset 3087:4a76da133144

Removed repeated x.size() calls from for loops. flys-artifacts/trunk@4684 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jun 2012 09:16:05 +0000
parents ba7df29264cd
children 960307cf2adc
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/map/PrintMap.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 9 files changed, 24 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jun 18 09:16:05 2012 +0000
@@ -1,3 +1,15 @@
+2012-06-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/map/PrintMap.java,
+	  src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java,
+	  src/main/java/de/intevation/flys/artifacts/states/SQRelation.java,
+	  src/main/java/de/intevation/flys/artifacts/states/DischargeState.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java,
+	  src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java,
+	  src/main/java/de/intevation/flys/exports/XYChartGenerator.java,
+	  src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java:
+	  Removed repeated x.size() calls from for loops.
+
 2012-06-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Mon Jun 18 09:16:05 2012 +0000
@@ -186,7 +186,7 @@
             logger.debug("Groups for connection string: " + m.groupCount());
             int groups = m.groupCount();
 
-            for (int i = 0; i <= m.groupCount(); i++) {
+            for (int i = 0; i <= groups; i++) {
                 logger.debug("Group " + i + ": " + m.group(i));
             }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/map/PrintMap.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/map/PrintMap.java	Mon Jun 18 09:16:05 2012 +0000
@@ -118,7 +118,7 @@
         List<Layer> layers = capabilities.getLayerList();
         WMSMapLayer[] wmslayers = new WMSMapLayer[layers.size()];
 
-        for (int i = 0; i < layers.size(); i++) {
+        for (int i = 0, L = layers.size(); i < L; i++) {
             Layer l = layers.get(i);
 
             System.out.println("   -> add layer: " + l);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Mon Jun 18 09:16:05 2012 +0000
@@ -59,7 +59,7 @@
 
         KVP[] kvp = new KVP[zones.size()];
 
-        for (int i = 0; i < zones.size(); i++) {
+        for (int i = 0, Z = zones.size(); i < Z; i++) {
             DischargeZone zone = zones.get(i);
 
             String lower = zone.getLowerDischarge();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SQRelation.java	Mon Jun 18 09:16:05 2012 +0000
@@ -82,7 +82,7 @@
         container.add(new SQMeasurementFacet(0, SQ_A_MEASUREMENT, "TODO"));
         container.add(new SQCurveFacet(0, SQ_A_CURVE, "TODO"));
 
-        for (int i = 0; i < sqr[0].getOutliersCount(); i++) {
+        for (int i = 0, C = sqr[0].getOutliersCount(); i < C; i++) {
             container.add(new SQOutlierFacet(
                 0,
                 i,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Mon Jun 18 09:16:05 2012 +0000
@@ -76,7 +76,7 @@
             BedHeightSingle.getBedHeightSingles(river, kmLo, kmHi);
 
         if (singles != null) {
-            for (int i = 0; i < singles.size(); i++) {
+            for (int i = 0, S = singles.size(); i < S; i++) {
                 BedHeightSingle s = singles.get(i);
 
                 String id    = PREFIX_SINGLE + s.getId();
@@ -98,7 +98,7 @@
             BedHeightEpoch.getBedHeightEpochs(river, kmLo, kmHi);
 
         if (epochs != null) {
-            for (int i = 0; i < epochs.size(); i++) {
+            for (int i = 0, E = epochs.size(); i < E; i++) {
                 BedHeightEpoch e = epochs.get(i);
 
                 String id    = PREFIX_EPOCH + e.getId();
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java	Mon Jun 18 09:16:05 2012 +0000
@@ -187,7 +187,7 @@
 
         if (dataNodes != null) {
             Document doc = ci.getOwnerDocument();
-            for (int i = 0; i < dataNodes.getLength(); i++) {
+            for (int i = 0, D = dataNodes.getLength(); i < D; i++) {
                 dataNode.appendChild(doc.importNode(dataNodes.item(i), true));
             }
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Mon Jun 18 09:16:05 2012 +0000
@@ -496,7 +496,7 @@
 
         try {
             JSONArray points = new JSONArray((String) o);
-            for (int i = 0; i < points.length(); i++) {
+            for (int i = 0, P = points.length(); i < P; i++) {
                 JSONArray array = points.getJSONArray(i);
                 double x    = array.getDouble(0);
                 double y    = array.getDouble(1);
@@ -519,7 +519,7 @@
         TimeSeriesCollection tsc = new TimeSeriesCollection();
         tsc.addSeries(series);
         // Add Annotations.
-        for (int i = 0; i < series.getItemCount(); i++) {
+        for (int i = 0, S = series.getItemCount(); i < S; i++) {
             double x = tsc.getXValue(0, i);
             double y = tsc.getYValue(0, i);
             xy.add(new CollisionFreeXYTextAnnotation(
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Jun 18 08:55:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Jun 18 09:16:05 2012 +0000
@@ -283,7 +283,7 @@
      */
     public void debugDatasets(XYPlot plot) {
         logger.debug("Number of datasets: " + plot.getDatasetCount());
-        for (int i = 0; i < plot.getDatasetCount(); i++) {
+        for (int i = 0, P = plot.getDatasetCount(); i < P; i++) {
             if (plot.getDataset(i) == null) {
                 logger.debug("Dataset #" + i + " is null");
                 continue;
@@ -303,7 +303,7 @@
      */
     public void debugAxis(XYPlot plot) {
         logger.debug("...............");
-        for (int i = 0; i < plot.getRangeAxisCount(); i++) {
+        for (int i = 0, P =  plot.getRangeAxisCount(); i < P; i++) {
             if (plot.getRangeAxis(i) == null)
                 logger.debug("Range-Axis #" + i + " == null");
             else {
@@ -1216,7 +1216,7 @@
 
         try {
             JSONArray points = new JSONArray((String) o);
-            for (int i = 0; i < points.length(); i++) {
+            for (int i = 0, P = points.length(); i < P; i++) {
                 JSONArray array = points.getJSONArray(i);
                 double x    = array.getDouble(0);
                 double y    = array.getDouble(1);

http://dive4elements.wald.intevation.org