changeset 6957:67e01d9c0519

AttributeWriter: Slightly improved variable naming and comments.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 03 Sep 2013 10:31:26 +0200
parents 33f3cc375a23
children d2bf655bd278
files artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org