[PATCH 1 of 5] AttributeWriter: Slightly improved variable naming and comments

Wald Commits scm-commit at wald.intevation.org
Wed Sep 4 08:06:18 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1378197086 -7200
# Node ID 67e01d9c051918f0f4b1d97dc729137d2fe1d6d3
# Parent  33f3cc375a2300bfeb81e3dfbe760a87ecae8d89
AttributeWriter: Slightly improved variable naming and comments.

diff -r 33f3cc375a23 -r 67e01d9c0519 artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java
--- a/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java	Fri Aug 30 16:30:54 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java	Tue Sep 03 10:31:26 2013 +0200
@@ -260,17 +260,20 @@
         // Preparations to be able to detect gaps.
         Map<Integer, ManagedFacet> mfmap =
             new HashMap<Integer, ManagedFacet>();
-        int max = 0;
+        int numFacets = 0;
         for (ManagedFacet mf: currentFacets) {
             int pos = mf.getPosition();
             mfmap.put(Integer.valueOf(pos), mf);
-            if (pos > max) max = pos;
+            if (pos > numFacets) numFacets = pos;
         }
 
-        // Finally do gap correction.
-        if (max != currentFacets.size()) {
+        // TODO issue1458: debug what happens
+
+        // Finally do gap correction
+        // (note that posistions start at 1, not at zero).
+        if (numFacets != currentFacets.size()) {
             int gap = 0;
-            for (int i = 1; i <= max; i++) {
+            for (int i = 1; i <= numFacets; i++) {
                 ManagedFacet mf = mfmap.get(Integer.valueOf(i));
                 if (mf == null) {
                     gap++;
@@ -281,8 +284,8 @@
         }
 
         // Now add all facets.
-        for (ManagedFacet oldMF: currentFacets) {
-            attribute.addFacet(outputName, oldMF);
+        for (ManagedFacet facet: currentFacets) {
+            attribute.addFacet(outputName, facet);
         }
 
         return !currentFacets.isEmpty();


More information about the Dive4elements-commits mailing list