Changeset 12726 in josm for trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
- Timestamp:
- 2017-09-04T23:45:49+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r12663 r12726 13 13 import java.util.List; 14 14 import java.util.Map; 15 import java.util.NoSuchElementException; 15 16 import java.util.Objects; 16 17 import java.util.stream.Collectors; … … 72 73 * Creates a command to change multiple tags of multiple objects 73 74 * 74 * @param objects the objects to modify 75 * @param ds The target data set. Must not be {@code null} 76 * @param objects the objects to modify. Must not be empty 75 77 * @param tags the tags to set 76 */ 77 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, Map<String, String> tags) { 78 * @since 12726 79 */ 80 public ChangePropertyCommand(DataSet ds, Collection<? extends OsmPrimitive> objects, Map<String, String> tags) { 81 super(ds); 78 82 this.tags = tags; 79 83 init(objects); … … 81 85 82 86 /** 87 * Creates a command to change multiple tags of multiple objects 88 * 89 * @param objects the objects to modify. Must not be empty, and objects must belong to a data set 90 * @param tags the tags to set 91 * @throws NullPointerException if objects is null or contain null item 92 * @throws NoSuchElementException if objects is empty 93 */ 94 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, Map<String, String> tags) { 95 this(objects.iterator().next().getDataSet(), objects, tags); 96 } 97 98 /** 83 99 * Creates a command to change one tag of multiple objects 84 100 * 85 * @param objects the objects to modify 101 * @param objects the objects to modify. Must not be empty, and objects must belong to a data set 86 102 * @param key the key of the tag to set 87 103 * @param value the value of the key to set 104 * @throws NullPointerException if objects is null or contain null item 105 * @throws NoSuchElementException if objects is empty 88 106 */ 89 107 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, String key, String value) { 108 super(objects.iterator().next().getDataSet()); 90 109 this.tags = new HashMap<>(1); 91 110 this.tags.put(key, value); … … 96 115 * Creates a command to change one tag of one object 97 116 * 98 * @param object the object to modify 117 * @param object the object to modify. Must belong to a data set 99 118 * @param key the key of the tag to set 100 119 * @param value the value of the key to set 120 * @throws NullPointerException if object is null 101 121 */ 102 122 public ChangePropertyCommand(OsmPrimitive object, String key, String value) { … … 134 154 @Override 135 155 public boolean executeCommand() { 136 if (objects.isEmpty())137 return true;138 156 final DataSet dataSet = objects.get(0).getDataSet(); 139 157 if (dataSet != null) {
Note:
See TracChangeset
for help on using the changeset viewer.