Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2014-04-26T17:39:23+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r6069 r7005 24 24 public class AddPrimitivesCommand extends Command { 25 25 26 private List<PrimitiveData> data = new ArrayList< PrimitiveData>();27 private Collection<PrimitiveData> toSelect = new ArrayList< PrimitiveData>();26 private List<PrimitiveData> data = new ArrayList<>(); 27 private Collection<PrimitiveData> toSelect = new ArrayList<>(); 28 28 29 29 // only filled on undo … … 71 71 Collection<OsmPrimitive> primitivesToSelect; 72 72 if (createdPrimitives == null) { // first time execution 73 List<OsmPrimitive> newPrimitives = new ArrayList< OsmPrimitive>(data.size());74 primitivesToSelect = new ArrayList< OsmPrimitive>(toSelect.size());73 List<OsmPrimitive> newPrimitives = new ArrayList<>(data.size()); 74 primitivesToSelect = new ArrayList<>(toSelect.size()); 75 75 76 76 for (PrimitiveData pd : data) { … … 115 115 116 116 if (createdPrimitives == null) { 117 createdPrimitives = new ArrayList< OsmPrimitive>(data.size());118 createdPrimitivesToSelect = new ArrayList< OsmPrimitive>(toSelect.size());117 createdPrimitives = new ArrayList<>(data.size()); 118 createdPrimitivesToSelect = new ArrayList<>(toSelect.size()); 119 119 120 120 for (PrimitiveData pd : data) { … … 162 162 return createdPrimitives; 163 163 164 Collection<OsmPrimitive> prims = new HashSet< OsmPrimitive>();164 Collection<OsmPrimitive> prims = new HashSet<>(); 165 165 for (PrimitiveData d : data) { 166 166 OsmPrimitive osm = getLayer().data.getPrimitiveById(d); -
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r6881 r7005 49 49 */ 50 50 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, AbstractMap<String, String> tags) { 51 this.objects = new LinkedList< OsmPrimitive>();51 this.objects = new LinkedList<>(); 52 52 this.tags = tags; 53 53 init(objects); … … 62 62 */ 63 63 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, String key, String value) { 64 this.objects = new LinkedList< OsmPrimitive>();65 this.tags = new HashMap< String, String>(1);64 this.objects = new LinkedList<>(); 65 this.tags = new HashMap<>(1); 66 66 this.tags.put(key, value); 67 67 init(objects); … … 201 201 if (objects.size() == 1) 202 202 return null; 203 List<PseudoCommand> children = new ArrayList< PseudoCommand>();203 List<PseudoCommand> children = new ArrayList<>(); 204 204 for (final OsmPrimitive osm : objects) { 205 205 children.add(new PseudoCommand() { -
trunk/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java
r6329 r7005 54 54 */ 55 55 public ChangePropertyKeyCommand(Collection<? extends OsmPrimitive> objects, String key, String newKey) { 56 this.objects = new LinkedList< OsmPrimitive>(objects);56 this.objects = new LinkedList<>(objects); 57 57 this.key = key; 58 58 this.newKey = newKey; … … 101 101 if (objects.size() == 1) 102 102 return null; 103 List<PseudoCommand> children = new ArrayList< PseudoCommand>();103 List<PseudoCommand> children = new ArrayList<>(); 104 104 105 105 final NameVisitor v = new NameVisitor(); -
trunk/src/org/openstreetmap/josm/command/Command.java
r6901 r7005 39 39 40 40 private static final class CloneVisitor extends AbstractVisitor { 41 public final Map<OsmPrimitive, PrimitiveData> orig = new LinkedHashMap< OsmPrimitive, PrimitiveData>();41 public final Map<OsmPrimitive, PrimitiveData> orig = new LinkedHashMap<>(); 42 42 43 43 @Override … … 76 76 77 77 /** the map of OsmPrimitives in the original state to OsmPrimitives in cloned state */ 78 private Map<OsmPrimitive, PrimitiveData> cloneMap = new HashMap< OsmPrimitive, PrimitiveData>();78 private Map<OsmPrimitive, PrimitiveData> cloneMap = new HashMap<>(); 79 79 80 80 /** the layer which this command is applied to */ … … 106 106 public boolean executeCommand() { 107 107 CloneVisitor visitor = new CloneVisitor(); 108 Collection<OsmPrimitive> all = new ArrayList< OsmPrimitive>();108 Collection<OsmPrimitive> all = new ArrayList<>(); 109 109 fillModifiedData(all, all, all); 110 110 for (OsmPrimitive osm : all) { -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r6901 r7005 51 51 */ 52 52 private final Collection<? extends OsmPrimitive> toDelete; 53 private final Map<OsmPrimitive, PrimitiveData> clonedPrimitives = new HashMap< OsmPrimitive, PrimitiveData>();53 private final Map<OsmPrimitive, PrimitiveData> clonedPrimitives = new HashMap<>(); 54 54 55 55 /** … … 150 150 151 151 private Set<OsmPrimitiveType> getTypesToDelete() { 152 Set<OsmPrimitiveType> typesToDelete = new HashSet< OsmPrimitiveType>();152 Set<OsmPrimitiveType> typesToDelete = new HashSet<>(); 153 153 for (OsmPrimitive osm : toDelete) { 154 154 typesToDelete.add(OsmPrimitiveType.from(osm)); … … 201 201 return null; 202 202 else { 203 List<PseudoCommand> children = new ArrayList< PseudoCommand>(toDelete.size());203 List<PseudoCommand> children = new ArrayList<>(toDelete.size()); 204 204 for (final OsmPrimitive osm : toDelete) { 205 205 children.add(new PseudoCommand() { … … 278 278 */ 279 279 protected static Collection<Node> computeNodesToDelete(OsmDataLayer layer, Collection<OsmPrimitive> primitivesToDelete) { 280 Collection<Node> nodesToDelete = new HashSet< Node>();280 Collection<Node> nodesToDelete = new HashSet<>(); 281 281 for (Way way : OsmPrimitive.getFilteredList(primitivesToDelete, Way.class)) { 282 282 for (Node n : way.getNodes()) { … … 339 339 return null; 340 340 341 Set<OsmPrimitive> primitivesToDelete = new HashSet< OsmPrimitive>(selection);341 Set<OsmPrimitive> primitivesToDelete = new HashSet<>(selection); 342 342 343 343 Collection<Relation> relationsToDelete = Utils.filteredCollection(primitivesToDelete, Relation.class); … … 345 345 return null; 346 346 347 Collection<Way> waysToBeChanged = new HashSet< Way>();347 Collection<Way> waysToBeChanged = new HashSet<>(); 348 348 349 349 if (alsoDeleteNodesInWay) { … … 359 359 waysToBeChanged.addAll(OsmPrimitive.getFilteredSet(OsmPrimitive.getReferrer(primitivesToDelete), Way.class)); 360 360 361 Collection<Command> cmds = new LinkedList< Command>();361 Collection<Command> cmds = new LinkedList<>(); 362 362 for (Way w : waysToBeChanged) { 363 363 Way wnew = new Way(w); … … 415 415 // the way shouldn't be splitted 416 416 417 List<Node> n = new ArrayList< Node>();417 List<Node> n = new ArrayList<>(); 418 418 419 419 n.addAll(ws.way.getNodes().subList(ws.lowerIndex + 1, ws.way.getNodesCount() - 1)); … … 426 426 } 427 427 428 List<Node> n1 = new ArrayList< Node>(), n2 = new ArrayList<Node>();428 List<Node> n1 = new ArrayList<>(), n2 = new ArrayList<>(); 429 429 430 430 n1.addAll(ws.way.getNodes().subList(0, ws.lowerIndex + 1)); … … 440 440 return new ChangeCommand(ws.way, wnew); 441 441 } else { 442 List<List<Node>> chunks = new ArrayList< List<Node>>(2);442 List<List<Node>> chunks = new ArrayList<>(2); 443 443 chunks.add(n1); 444 444 chunks.add(n2); -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r6890 r7005 30 30 * The objects that should be moved. 31 31 */ 32 private Collection<Node> nodes = new LinkedList< Node>();32 private Collection<Node> nodes = new LinkedList<>(); 33 33 /** 34 34 * Starting position, base command point, current (mouse-drag) position = startEN + (x,y) = … … 51 51 * List of all old states of the objects. 52 52 */ 53 private List<OldNodeState> oldState = new LinkedList< OldNodeState>();53 private List<OldNodeState> oldState = new LinkedList<>(); 54 54 55 55 /** -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r6890 r7005 68 68 69 69 protected final void saveIncomplete(Collection<OsmPrimitive> makeIncomplete) { 70 makeIncompleteData = new Storage< PrimitiveData>(new Storage.PrimitiveIdHash());70 makeIncompleteData = new Storage<>(new Storage.PrimitiveIdHash()); 71 71 makeIncompleteData_byPrimId = makeIncompleteData.foreignKey(new Storage.PrimitiveIdHash()); 72 72 … … 143 143 */ 144 144 public static List<OsmPrimitive> topoSort(Collection<OsmPrimitive> sel) { 145 Set<OsmPrimitive> in = new HashSet< OsmPrimitive>(sel);146 147 List<OsmPrimitive> out = new ArrayList< OsmPrimitive>(in.size());145 Set<OsmPrimitive> in = new HashSet<>(sel); 146 147 List<OsmPrimitive> out = new ArrayList<>(in.size()); 148 148 149 149 // Nodes not deleted in the first pass 150 Set<OsmPrimitive> remainingNodes = new HashSet< OsmPrimitive>(in.size());150 Set<OsmPrimitive> remainingNodes = new HashSet<>(in.size()); 151 151 152 152 /** … … 198 198 @SuppressWarnings({ "unchecked", "rawtypes" }) 199 199 Set<Relation> inR = (Set) in; 200 Set<Relation> childlessR = new HashSet< Relation>();201 List<Relation> outR = new ArrayList< Relation>(inR.size());202 203 HashMap<Relation, Integer> numChilds = new HashMap< Relation, Integer>();200 Set<Relation> childlessR = new HashSet<>(); 201 List<Relation> outR = new ArrayList<>(inR.size()); 202 203 HashMap<Relation, Integer> numChilds = new HashMap<>(); 204 204 205 205 // calculate initial number of childs -
trunk/src/org/openstreetmap/josm/command/RemoveNodesCommand.java
r6881 r7005 37 37 public RemoveNodesCommand(Way way, List<Node> rmNodes) { 38 38 this.way = way; 39 this.rmNodes = new HashSet< Node>(rmNodes);39 this.rmNodes = new HashSet<>(rmNodes); 40 40 } 41 41 -
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r6450 r7005 108 108 @Override 109 109 public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 110 Collection<OsmPrimitive> prims = new HashSet< OsmPrimitive>();110 Collection<OsmPrimitive> prims = new HashSet<>(); 111 111 for (Command c : sequence) { 112 112 prims.addAll(c.getParticipatingPrimitives()); -
trunk/src/org/openstreetmap/josm/command/TransformNodesCommand.java
r6890 r7005 27 27 * The nodes to transform. 28 28 */ 29 protected Collection<Node> nodes = new LinkedList< Node>();29 protected Collection<Node> nodes = new LinkedList<>(); 30 30 31 31 … … 33 33 * List of all old states of the nodes. 34 34 */ 35 protected Map<Node, OldNodeState> oldStates = new HashMap< Node, OldNodeState>();35 protected Map<Node, OldNodeState> oldStates = new HashMap<>(); 36 36 37 37 /**
Note: See TracChangeset
for help on using the changeset viewer.