purgedConflicts.get().clear();
/**
* Loop from back to front to keep referential integrity.
*/
for (int i=toPurge.size()-1; i>=0; --i) {
OsmPrimitive osm = toPurge.get(i);
if (makeIncompleteData_byPrimId.containsKey(osm)) {
// we could simply set the incomplete flag
// but that would not free memory in case the
// user clears undo/redo buffer after purge
PrimitiveData empty;
switch(osm.getType()) {
case NODE: empty = new NodeData(); break;
case WAY: empty = new WayData(); break;
case RELATION: empty = new RelationData(); break;
default: throw new AssertionError();
}
empty.setId(osm.getUniqueId());
empty.setIncomplete(true);
osm.load(empty);
} else {
ds.removePrimitive(osm);
Conflict<?> conflict = getLayer().getConflicts().getConflictForMy(osm);
if (conflict != null) {
purgedConflicts.add(conflict);