Revision 46905
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java | ||
---|---|---|
30 | 30 |
import java.util.logging.Logger; |
31 | 31 |
import org.gvsig.fmap.dal.exception.DataException; |
32 | 32 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
33 |
import org.gvsig.fmap.dal.feature.Feature; |
|
33 | 34 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
34 | 35 |
import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException; |
35 | 36 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeature; |
... | ... | |
137 | 138 |
@Override |
138 | 139 |
public Object next() { |
139 | 140 |
if (store.isEditing()) { |
140 |
return super.next(); |
|
141 |
Feature n = (Feature) super.next(); |
|
142 |
this.visitedReferences.add(n.getReference()); |
|
143 |
return n; |
|
141 | 144 |
} else { |
142 | 145 |
throw new ConcurrentDataModificationException(store.getFullName()); |
143 | 146 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/editing/memory/MemoryExpansionAdapter.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.dal.feature.impl.editing.memory; |
25 | 25 |
|
26 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.ExpansionAdapter; |
|
27 | 26 |
import java.util.ArrayList; |
28 | 27 |
import java.util.HashMap; |
29 | 28 |
import java.util.Iterator; |
... | ... | |
105 | 104 |
} |
106 | 105 |
|
107 | 106 |
public Iterator iterator() { |
108 |
return objects.iterator(); |
|
107 |
// No podemos usar objects.iterator ya que se est? a?adiendo elementos |
|
108 |
// a la lista mientras se itera sobre ella |
|
109 |
// y fallar?a con un ConcurrentModificationException. |
|
110 |
// Esta implementaci?n es resistente a la comodificaci?n ya nunca se eliminan elementos de objects |
|
111 |
return new Iterator() { |
|
112 |
int i = 0; |
|
113 |
@Override |
|
114 |
public boolean hasNext() { |
|
115 |
return i < objects.size(); |
|
116 |
} |
|
117 |
|
|
118 |
@Override |
|
119 |
public Object next() { |
|
120 |
return objects.get(i++); |
|
121 |
} |
|
122 |
}; |
|
109 | 123 |
} |
110 | 124 |
} |
Also available in: Unified diff