- Timestamp:
- 2015-10-10T15:47:41+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r8846 r8851 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.util.ArrayDeque; 10 11 import java.util.ArrayList; 11 12 import java.util.Collection; 12 13 import java.util.Collections; 14 import java.util.Deque; 13 15 import java.util.LinkedHashMap; 14 16 import java.util.LinkedHashSet; … … 17 19 import java.util.Map; 18 20 import java.util.Set; 19 import java.util.Stack;20 21 21 22 import javax.swing.JOptionPane; … … 557 558 } 558 559 559 protected Set<Node> getNodes(Stack<NodePair> pairs) {560 Set<Node> nodes = new LinkedHashSet<>(2*pairs.size());561 for (NodePair pair: pairs) {562 nodes.add(pair.getA());563 nodes.add(pair.getB());564 }565 return nodes;566 }567 568 560 protected List<NodePair> getOutboundPairs(NodePair pair) { 569 561 return getOutboundPairs(pair.getB()); … … 586 578 } 587 579 588 protected boolean isSpanningWay( Stack<NodePair> way) {580 protected boolean isSpanningWay(Deque<NodePair> way) { 589 581 return numUndirectedEges == way.size(); 590 582 } 591 583 592 protected List<Node> buildPathFromNodePairs( Stack<NodePair> path) {584 protected List<Node> buildPathFromNodePairs(Deque<NodePair> path) { 593 585 List<Node> ret = new LinkedList<>(); 594 586 for (NodePair pair: path) { … … 610 602 if (startNode == null) 611 603 return null; 612 Stack<NodePair> path = new Stack<>();613 Stack<NodePair> nextPairs = new Stack<>();604 Deque<NodePair> path = new ArrayDeque<>(); 605 Deque<NodePair> nextPairs = new ArrayDeque<>(); 614 606 nextPairs.addAll(getOutboundPairs(startNode)); 615 607 while (!nextPairs.isEmpty()) { -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r8836 r8851 8 8 import java.awt.event.KeyEvent; 9 9 import java.io.IOException; 10 import java.util.ArrayDeque; 10 11 import java.util.Collection; 12 import java.util.Deque; 11 13 import java.util.HashSet; 12 14 import java.util.Set; 13 import java.util.Stack;14 15 15 16 import javax.swing.JOptionPane; … … 321 322 protected void realRun() throws SAXException, IOException, OsmTransferException { 322 323 try { 323 Stack<OsmPrimitive> toCheck = new Stack<>();324 Deque<OsmPrimitive> toCheck = new ArrayDeque<>(); 324 325 toCheck.addAll(getPrimitivesToCheckForParents()); 325 326 Set<OsmPrimitive> checked = new HashSet<>(); -
trunk/src/org/openstreetmap/josm/actions/upload/CyclicUploadDependencyException.java
r8510 r8851 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.ArrayList; 7 import java.util.List; 8 import java.util.Stack; 6 import java.util.ArrayDeque; 7 import java.util.Deque; 9 8 10 9 import org.openstreetmap.josm.data.osm.Relation; 11 10 12 11 public class CyclicUploadDependencyException extends Exception { 13 private final Stack<Relation> cycle;12 private final Deque<Relation> cycle; 14 13 15 public CyclicUploadDependencyException( Stack<Relation> cycle) {14 public CyclicUploadDependencyException(Deque<Relation> cycle) { 16 15 this.cycle = cycle; 17 16 } … … 34 33 sb.append(tr("Cyclic dependency between relations:")) 35 34 .append('['); 36 for ( int i = 0; i < cycle.size(); i++) {37 if ( i> 0) {35 for (Relation r : cycle) { 36 if (sb.length() > 0) { 38 37 sb.append(','); 39 38 } 40 sb.append(formatRelation( cycle.get(i)));39 sb.append(formatRelation(r)); 41 40 } 42 41 sb.append(']'); … … 44 43 } 45 44 46 public List<Relation> getCyclicUploadDependency() {47 return new Array List<>(cycle);45 public Deque<Relation> getCyclicUploadDependency() { 46 return new ArrayDeque<>(cycle); 48 47 } 49 48 } -
trunk/src/org/openstreetmap/josm/actions/upload/RelationUploadOrderHook.java
r8510 r8851 6 6 import java.awt.BorderLayout; 7 7 import java.awt.Dimension; 8 import java.util.ArrayList; 9 import java.util.Deque; 8 10 import java.util.Iterator; 9 11 import java.util.List; … … 67 69 */ 68 70 protected void warnCyclicUploadDependency(CyclicUploadDependencyException e) { 69 List<Relation> dep = e.getCyclicUploadDependency();70 Relation last = dep.get (dep.size() -1);71 Deque<Relation> dep = e.getCyclicUploadDependency(); 72 Relation last = dep.getLast(); 71 73 Iterator<Relation> it = dep.iterator(); 72 74 while (it.hasNext()) { … … 77 79 } 78 80 } 79 JPanel pnl = buildWarningPanel( dep);81 JPanel pnl = buildWarningPanel(new ArrayList<>(dep)); 80 82 ExtendedDialog dialog = new ExtendedDialog( 81 83 Main.parent, -
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r8836 r8851 2 2 package org.openstreetmap.josm.data; 3 3 4 import java.util.ArrayDeque; 4 5 import java.util.ArrayList; 5 6 import java.util.Collection; 6 7 import java.util.Collections; 7 8 import java.util.Comparator; 9 import java.util.Deque; 8 10 import java.util.HashMap; 9 11 import java.util.HashSet; … … 12 14 import java.util.Map; 13 15 import java.util.Set; 14 import java.util.Stack;15 16 16 17 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException; … … 309 310 } 310 311 311 protected void visit( Stack<Relation> path, Relation current) throws CyclicUploadDependencyException {312 protected void visit(Deque<Relation> path, Relation current) throws CyclicUploadDependencyException { 312 313 if (path.contains(current)) { 313 314 path.push(current); … … 328 329 visited = new HashSet<>(); 329 330 uploadOrder = new LinkedList<>(); 330 Stack<Relation> path = new Stack<>();331 Deque<Relation> path = new ArrayDeque<>(); 331 332 for (Relation relation: relations) { 332 333 visit(path, relation); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r8846 r8851 11 11 import java.nio.charset.StandardCharsets; 12 12 import java.text.NumberFormat; 13 import java.util.ArrayDeque; 13 14 import java.util.ArrayList; 14 15 import java.util.Collection; 15 16 import java.util.Collections; 16 17 import java.util.Date; 18 import java.util.Deque; 17 19 import java.util.HashSet; 18 20 import java.util.LinkedList; … … 21 23 import java.util.Map.Entry; 22 24 import java.util.Set; 23 import java.util.Stack;24 25 import java.util.TreeMap; 25 26 import java.util.concurrent.CopyOnWriteArrayList; … … 649 650 } 650 651 651 private Stack<ZoomData> zoomUndoBuffer = new Stack<>();652 private Stack<ZoomData> zoomRedoBuffer = new Stack<>();652 private Deque<ZoomData> zoomUndoBuffer = new ArrayDeque<>(); 653 private Deque<ZoomData> zoomRedoBuffer = new ArrayDeque<>(); 653 654 private Date zoomTimestamp = new Date(); 654 655 -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r8836 r8851 9 9 import java.awt.event.KeyEvent; 10 10 import java.awt.event.MouseEvent; 11 import java.util.ArrayDeque; 11 12 import java.util.ArrayList; 12 13 import java.util.Arrays; 13 14 import java.util.Collection; 15 import java.util.Deque; 14 16 import java.util.HashSet; 15 17 import java.util.List; 16 18 import java.util.Set; 17 import java.util.Stack;18 19 19 20 import javax.swing.AbstractAction; … … 291 292 // Filters can use nested parent/child expression so complete tree is necessary 292 293 Set<OsmPrimitive> result = new HashSet<>(); 293 Stack<OsmPrimitive> stack = new Stack<>();294 Deque<OsmPrimitive> stack = new ArrayDeque<>(); 294 295 stack.addAll(primitives); 295 296 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r8836 r8851 12 12 import java.io.IOException; 13 13 import java.net.HttpURLConnection; 14 import java.util.ArrayDeque; 15 import java.util.Deque; 14 16 import java.util.HashSet; 15 17 import java.util.Iterator; 16 18 import java.util.List; 17 19 import java.util.Set; 18 import java.util.Stack;19 20 20 21 import javax.swing.AbstractAction; … … 329 330 class DownloadAllChildrenTask extends DownloadTask { 330 331 private final Relation relation; 331 private final Stack<Relation> relationsToDownload;332 private final Deque<Relation> relationsToDownload; 332 333 private final Set<Long> downloadedRelationIds; 333 334 … … 335 336 super(tr("Download relation members"), parent); 336 337 this.relation = r; 337 relationsToDownload = new Stack<>();338 relationsToDownload = new ArrayDeque<>(); 338 339 downloadedRelationIds = new HashSet<>(); 339 340 relationsToDownload.push(this.relation); -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r8840 r8851 199 199 private static class NameFinderResultParser extends DefaultHandler { 200 200 private SearchResult currentResult; 201 private StringBu ffer description;201 private StringBuilder description; 202 202 private int depth; 203 203 private List<SearchResult> data = new LinkedList<>(); … … 226 226 data.add(currentResult); 227 227 } else if ("description".equals(qName) && (depth == 3)) { 228 description = new StringBu ffer();228 description = new StringBuilder(); 229 229 } else if ("named".equals(qName) && (depth == 4)) { 230 230 // this is a "named" place in the nearest places list. -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r8846 r8851 26 26 import java.text.AttributedString; 27 27 import java.util.ArrayList; 28 import java.util.Hash table;28 import java.util.HashMap; 29 29 import java.util.List; 30 30 import java.util.Map; … … 405 405 } else { 406 406 // Draw message on several lines 407 Map<TextAttribute, Object> map = new Hash table<TextAttribute, Object>();407 Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>(); 408 408 map.put(TextAttribute.FAMILY, "Serif"); 409 409 map.put(TextAttribute.SIZE, new Float(18.0)); -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r8602 r8851 118 118 @Override 119 119 public String nameSupportedProjections() { 120 StringBu ffer ret = new StringBuffer();120 StringBuilder ret = new StringBuilder(); 121 121 for (String e: supportedProjections) { 122 122 ret.append(e).append(", "); -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r8846 r8851 7 7 import java.io.InputStream; 8 8 import java.io.Reader; 9 import java.util.ArrayDeque; 9 10 import java.util.ArrayList; 10 11 import java.util.Collection; 12 import java.util.Deque; 11 13 import java.util.HashMap; 12 14 import java.util.LinkedList; 13 15 import java.util.List; 14 16 import java.util.Map; 15 import java.util.Stack;16 17 17 18 import javax.xml.parsers.ParserConfigurationException; … … 64 65 private GpxLink currentLink; 65 66 private Extensions currentExtensions; 66 private Stack<State> states;67 private final Stack<String> elements = new Stack<>();68 69 private StringBu ffer accumulator = new StringBuffer();67 private Deque<State> states; 68 private final Deque<String> elements = new ArrayDeque<>(); 69 70 private StringBuilder accumulator = new StringBuilder(); 70 71 71 72 private boolean nokiaSportsTrackerBug; … … 73 74 @Override 74 75 public void startDocument() { 75 accumulator = new StringBu ffer();76 states = new Stack<>();76 accumulator = new StringBuilder(); 77 states = new ArrayDeque<>(); 77 78 data = new GpxData(); 78 79 } … … 476 477 @Override 477 478 public void endDocument() throws SAXException { 478 if (!states. empty())479 if (!states.isEmpty()) 479 480 throw new SAXException(tr("Parse error: invalid document structure for GPX document.")); 480 481 Extensions metaExt = (Extensions) data.get(META_EXTENSIONS); -
trunk/src/org/openstreetmap/josm/io/NoteReader.java
r8510 r8851 49 49 50 50 private NoteParseMode parseMode; 51 private StringBu ffer buffer = new StringBuffer();51 private StringBuilder buffer = new StringBuilder(); 52 52 private Note thisNote; 53 53 private long commentUid; -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r8846 r8851 4 4 import java.io.IOException; 5 5 import java.io.InputStream; 6 import java.util.ArrayDeque; 6 7 import java.util.ArrayList; 7 8 import java.util.Arrays; 9 import java.util.Deque; 8 10 import java.util.HashMap; 9 11 import java.util.List; 10 12 import java.util.Map; 11 13 import java.util.Objects; 12 import java.util.Stack;13 14 14 15 import javax.xml.parsers.ParserConfigurationException; … … 70 71 71 72 private static class Parser extends DefaultHandler { 72 private StringBu ffer accumulator = new StringBuffer();73 74 private Stack<State> states;73 private StringBuilder accumulator = new StringBuilder(); 74 75 private Deque<State> states; 75 76 76 77 private List<ImageryInfo> entries; … … 93 94 @Override 94 95 public void startDocument() { 95 accumulator = new StringBu ffer();96 accumulator = new StringBuilder(); 96 97 skipEntry = false; 97 states = new Stack<>();98 states = new ArrayDeque<>(); 98 99 states.push(State.INIT); 99 100 entries = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r8846 r8851 10 10 import java.lang.reflect.Method; 11 11 import java.lang.reflect.Modifier; 12 import java.util.ArrayDeque; 13 import java.util.Deque; 12 14 import java.util.HashMap; 13 15 import java.util.Iterator; … … 16 18 import java.util.Locale; 17 19 import java.util.Map; 18 import java.util.Stack;19 20 20 21 import javax.xml.XMLConstants; … … 64 65 65 66 private class Parser extends DefaultHandler { 66 private Stack<Object> current = new Stack<>();67 private Deque<Object> current = new ArrayDeque<>(); 67 68 private StringBuilder characters = new StringBuilder(64); 68 69
Note:
See TracChangeset
for help on using the changeset viewer.