Changeset 11318 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2016-11-26T21:28:20+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
r10413 r11318 11 11 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.data.conflict.Conflict; 13 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 15 import org.openstreetmap.josm.data.osm.Relation; … … 19 20 /** 20 21 * Represents the resolution of conflicts in the member list of two {@link Relation}s. 21 * 22 * @since 1631 22 23 */ 23 24 public class RelationMemberConflictResolverCommand extends ConflictResolveCommand { 24 /** my relation */ 25 private final Relation my; 26 /** their relation */ 27 private final Relation their; 28 /** the list of merged nodes. This becomes the list of news of my way after the 29 * command is executed 30 */ 25 /** the conflict to resolve */ 26 private final Conflict<Relation> conflict; 27 /** the list of merged nodes. This becomes the list of news of my way after the command is executed */ 31 28 private final List<RelationMember> mergedMembers; 32 29 33 30 /** 34 * 35 * @param my my relation 36 * @param their their relation 31 * Constructs a new {@code RelationMemberConflictResolverCommand}. 32 * @param conflict the conflict to resolve 37 33 * @param mergedMembers the list of merged relation members 38 34 */ 39 public RelationMemberConflictResolverCommand(Relation my, Relation their, List<RelationMember> mergedMembers) {40 this.my = my;41 this. their = their;35 @SuppressWarnings("unchecked") 36 public RelationMemberConflictResolverCommand(Conflict<? extends OsmPrimitive> conflict, List<RelationMember> mergedMembers) { 37 this.conflict = (Conflict<Relation>) conflict; 42 38 this.mergedMembers = mergedMembers; 43 39 } … … 45 41 @Override 46 42 public String getDescriptionText() { 47 return tr("Resolve conflicts in member list of relation {0}", my.getId());43 return tr("Resolve conflicts in member list of relation {0}", conflict.getMy().getId()); 48 44 } 49 45 … … 61 57 // replace the list of members of 'my' relation by the list of merged members 62 58 // 63 my.setMembers(mergedMembers);59 conflict.getMy().setMembers(mergedMembers); 64 60 65 61 return true; … … 69 65 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, 70 66 Collection<OsmPrimitive> added) { 71 modified.add( my);67 modified.add(conflict.getMy()); 72 68 } 73 69 … … 92 88 // restore a conflict if necessary 93 89 // 94 if (!editLayer.getConflicts().hasConflictForMy( my)) {95 editLayer.getConflicts().add( my, their);90 if (!editLayer.getConflicts().hasConflictForMy(conflict.getMy())) { 91 editLayer.getConflicts().add(conflict); 96 92 } 97 93 } … … 99 95 @Override 100 96 public int hashCode() { 101 return Objects.hash(super.hashCode(), my, their, mergedMembers);97 return Objects.hash(super.hashCode(), conflict, mergedMembers); 102 98 } 103 99 … … 108 104 if (!super.equals(obj)) return false; 109 105 RelationMemberConflictResolverCommand that = (RelationMemberConflictResolverCommand) obj; 110 return Objects.equals(my, that.my) && 111 Objects.equals(their, that.their) && 112 Objects.equals(mergedMembers, that.mergedMembers); 106 return Objects.equals(conflict, that.conflict) && 107 Objects.equals(mergedMembers, that.mergedMembers); 113 108 } 114 109 }
Note: See TracChangeset
for help on using the changeset viewer.