Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java @ 6958:d2bf655bd278
AttributeWriter: Even better variable name.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 03 Sep 2013 10:33:38 +0200 |
parents | 67e01d9c0519 |
children | 6bc333c162d1 |
comparison
equal
deleted
inserted
replaced
6957:67e01d9c0519 | 6958:d2bf655bd278 |
---|---|
258 // Fill/correct "gaps" (e.g. position 1,2,5 are taken, after gap filling | 258 // Fill/correct "gaps" (e.g. position 1,2,5 are taken, after gap filling |
259 // expect positions 1,2,3 [5->3]) | 259 // expect positions 1,2,3 [5->3]) |
260 // Preparations to be able to detect gaps. | 260 // Preparations to be able to detect gaps. |
261 Map<Integer, ManagedFacet> mfmap = | 261 Map<Integer, ManagedFacet> mfmap = |
262 new HashMap<Integer, ManagedFacet>(); | 262 new HashMap<Integer, ManagedFacet>(); |
263 int numFacets = 0; | 263 int maxPosition = 0; |
264 for (ManagedFacet mf: currentFacets) { | 264 for (ManagedFacet mf: currentFacets) { |
265 int pos = mf.getPosition(); | 265 int pos = mf.getPosition(); |
266 mfmap.put(Integer.valueOf(pos), mf); | 266 mfmap.put(Integer.valueOf(pos), mf); |
267 if (pos > numFacets) numFacets = pos; | 267 if (pos > maxPosition) maxPosition = pos; |
268 } | 268 } |
269 | 269 |
270 // TODO issue1458: debug what happens | 270 // TODO issue1458: debug what happens |
271 | 271 |
272 // Finally do gap correction | 272 // Finally do gap correction |
273 // (note that posistions start at 1, not at zero). | 273 // (note that posistions start at 1, not at zero). |
274 if (numFacets != currentFacets.size()) { | 274 if (maxPosition != currentFacets.size()) { |
275 int gap = 0; | 275 int gap = 0; |
276 for (int i = 1; i <= numFacets; i++) { | 276 for (int i = 1; i <= maxPosition; i++) { |
277 ManagedFacet mf = mfmap.get(Integer.valueOf(i)); | 277 ManagedFacet mf = mfmap.get(Integer.valueOf(i)); |
278 if (mf == null) { | 278 if (mf == null) { |
279 gap++; | 279 gap++; |
280 continue; | 280 continue; |
281 } | 281 } |