Changeset 3034 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2010-02-23T08:58:12+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/Command.java
r2932 r3034 2 2 package org.openstreetmap.josm.command; 3 3 4 import java.util.ArrayList; 4 5 import java.util.Collection; 5 6 import java.util.HashMap; 6 import java.util. HashSet;7 import java.util.LinkedHashMap; 7 8 import java.util.Map; 8 9 import java.util.Map.Entry; … … 32 33 33 34 private static final class CloneVisitor extends AbstractVisitor { 34 public Map<OsmPrimitive, PrimitiveData> orig = newHashMap<OsmPrimitive, PrimitiveData>();35 public final Map<OsmPrimitive, PrimitiveData> orig = new LinkedHashMap<OsmPrimitive, PrimitiveData>(); 35 36 36 37 public void visit(Node n) { … … 72 73 public boolean executeCommand() { 73 74 CloneVisitor visitor = new CloneVisitor(); 74 Collection<OsmPrimitive> all = new HashSet<OsmPrimitive>();75 Collection<OsmPrimitive> all = new ArrayList<OsmPrimitive>(); 75 76 fillModifiedData(all, all, all); 76 77 for (OsmPrimitive osm : all) { -
trunk/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java
r2512 r3034 23 23 24 24 /** the conflict to resolve */ 25 private Conflict< Node> conflict;25 private Conflict<? extends OsmPrimitive> conflict; 26 26 27 27 /** the merge decision */ … … 35 35 * @param decision the merge decision 36 36 */ 37 public CoordinateConflictResolveCommand( Node my, Node their, MergeDecisionType decision) {38 this.conflict = new Conflict<Node>(my,their);37 public CoordinateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) { 38 this.conflict = conflict; 39 39 this.decision = decision; 40 40 } … … 61 61 // do nothing 62 62 } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) { 63 Node my = conflict.getMy();64 Node their = conflict.getTheir();63 Node my = (Node)conflict.getMy(); 64 Node their = (Node)conflict.getTheir(); 65 65 my.setCoor(their.getCoor()); 66 66 } else -
trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java
r2945 r3034 23 23 24 24 /** the conflict to resolve */ 25 private Conflict< OsmPrimitive> conflict;25 private Conflict<? extends OsmPrimitive> conflict; 26 26 27 27 /** the merge decision */ … … 35 35 * @param decision the merge decision 36 36 */ 37 public DeletedStateConflictResolveCommand( OsmPrimitive my, OsmPrimitive their, MergeDecisionType decision) {38 this.conflict = new Conflict<OsmPrimitive>(my, their);37 public DeletedStateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) { 38 this.conflict = conflict; 39 39 this.decision = decision; 40 40 } … … 61 61 62 62 if (decision.equals(MergeDecisionType.KEEP_MINE)) { 63 if (conflict.getMy().isDeleted() ) {63 if (conflict.getMy().isDeleted() || conflict.isMyDeleted()) { 64 64 // because my was involved in a conflict it my still be referred 65 65 // to from a way or a relation. Fix this now. 66 66 // 67 67 layer.data.unlinkReferencesToPrimitive(conflict.getMy()); 68 conflict.getMy().setDeleted(true); 68 69 } 69 70 } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) { … … 86 87 Collection<OsmPrimitive> added) { 87 88 modified.add(conflict.getMy()); 89 modified.addAll(conflict.getMy().getReferrers()); 88 90 } 89 91 } -
trunk/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java
r2844 r3034 24 24 25 25 /** the conflict to resolve */ 26 private Conflict< OsmPrimitive> conflict;26 private Conflict<? extends OsmPrimitive> conflict; 27 27 28 28 /** … … 31 31 * @param their their primitive (i.e. the primitive from the server) 32 32 */ 33 public ModifiedConflictResolveCommand( OsmPrimitive my, OsmPrimitive their) {34 conflict = new Conflict<OsmPrimitive>(my, their);33 public ModifiedConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) { 34 this.conflict = conflict; 35 35 } 36 36 -
trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
r2990 r3034 29 29 30 30 /** the conflict to resolve */ 31 private Conflict< OsmPrimitive> conflict;31 private Conflict<? extends OsmPrimitive> conflict; 32 32 33 33 /** the list of merge decisions, represented as {@see TagMergeItem}s */ … … 56 56 * @param mergeItems the list of merge decisions, represented as {@see TagMergeItem}s 57 57 */ 58 public TagConflictResolveCommand( OsmPrimitive my, OsmPrimitive their, List<TagMergeItem> mergeItems) {59 this.conflict = new Conflict<OsmPrimitive>(my,their);58 public TagConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, List<TagMergeItem> mergeItems) { 59 this.conflict = conflict; 60 60 this.mergeItems = mergeItems; 61 61 } -
trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
r2844 r3034 24 24 25 25 /** the conflict to resolve */ 26 private Conflict< OsmPrimitive> conflict;26 private Conflict<? extends OsmPrimitive> conflict; 27 27 28 28 /** … … 31 31 * @param their their primitive (i.e. the primitive from the server) 32 32 */ 33 public VersionConflictResolveCommand( OsmPrimitive my, OsmPrimitive their) {34 conflict = new Conflict<OsmPrimitive>(my, their);33 public VersionConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) { 34 this.conflict = conflict; 35 35 } 36 36 … … 39 39 String msg = ""; 40 40 switch(OsmPrimitiveType.from(conflict.getMy())) { 41 42 43 41 case NODE: msg = marktr("Resolve version conflict for node {0}"); break; 42 case WAY: msg = marktr("Resolve version conflict for way {0}"); break; 43 case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break; 44 44 } 45 45 return new DefaultMutableTreeNode( -
trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java
r2512 r3034 41 41 * @param mergedNodeList the list of merged nodes 42 42 */ 43 public WayNodesConflictResolverCommand(Way my, Way their, List<Node> mergedNodeList) { 44 conflict = new Conflict<Way>(my,their); 43 @SuppressWarnings("unchecked") 44 public WayNodesConflictResolverCommand(Conflict<? extends OsmPrimitive> conflict, List<Node> mergedNodeList) { 45 this.conflict = (Conflict<Way>) conflict; 45 46 this.mergedNodeList = mergedNodeList; 46 47 }
Note: See TracChangeset
for help on using the changeset viewer.