Changeset 9854 in josm for trunk/src/org
- Timestamp:
- 2016-02-23T02:11:42+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r9073 r9854 11 11 import java.util.List; 12 12 import java.util.Map; 13 import java.util.NoSuchElementException; 13 14 import java.util.Set; 14 15 … … 32 33 public boolean fromServer; 33 34 35 /** Creator (usually software) */ 34 36 public String creator; 35 37 38 /** Tracks */ 36 39 public final Collection<GpxTrack> tracks = new LinkedList<>(); 40 /** Routes */ 37 41 public final Collection<GpxRoute> routes = new LinkedList<>(); 42 /** Waypoints */ 38 43 public final Collection<WayPoint> waypoints = new LinkedList<>(); 39 44 … … 46 51 public final Set<DataSource> dataSources = new HashSet<>(); 47 52 53 /** 54 * Merges data from another object. 55 * @param other existing GPX data 56 */ 48 57 public void mergeFrom(GpxData other) { 49 58 if (storageFile == null && other.storageFile != null) { … … 361 370 } 362 371 372 /** 373 * Resets the internal caches of east/north coordinates. 374 */ 363 375 public void resetEastNorthCache() { 364 376 if (waypoints != null) { … … 401 413 private final boolean[] trackVisibility; 402 414 415 /** 416 * Constructs a new {@code LinesIterator}. 417 * @param data GPX data 418 * @param trackVisibility An array indicating which tracks should be 419 * included in the iteration. Can be null, then all tracks are included. 420 */ 403 421 public LinesIterator(GpxData data, boolean[] trackVisibility) { 404 422 itTracks = data.tracks.iterator(); … … 416 434 @Override 417 435 public Collection<WayPoint> next() { 436 if (!hasNext()) { 437 throw new NoSuchElementException(); 438 } 418 439 Collection<WayPoint> current = next; 419 440 next = getNext(); -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r9243 r9854 7 7 import java.util.Iterator; 8 8 import java.util.List; 9 import java.util.NoSuchElementException; 9 10 10 11 import org.openstreetmap.josm.Main; … … 475 476 } 476 477 478 /** 479 * Converts to list. 480 * @return elements as list 481 */ 477 482 public List<T> toList() { 478 483 List<T> a = new ArrayList<>(); … … 498 503 private int iteratedOver; 499 504 500 final QBLevel<T> next _content_node(QBLevel<T> q) {505 final QBLevel<T> nextContentNode(QBLevel<T> q) { 501 506 if (q == null) 502 507 return null; … … 514 519 currentNode = qb.root; 515 520 } else { 516 currentNode = next _content_node(qb.root);521 currentNode = nextContentNode(qb.root); 517 522 } 518 523 iteratedOver = 0; … … 531 536 while ((currentNode.content == null) || (contentIndex >= currentNode.content.size())) { 532 537 contentIndex = 0; 533 currentNode = next _content_node(currentNode);538 currentNode = nextContentNode(currentNode); 534 539 if (currentNode == null) { 535 540 break; … … 544 549 public T next() { 545 550 T ret = peek(); 551 if (ret == null) 552 throw new NoSuchElementException(); 546 553 contentIndex++; 547 554 iteratedOver++; … … 576 583 } 577 584 578 public List<T> search(BBox search _bbox) {585 public List<T> search(BBox searchBbox) { 579 586 List<T> ret = new ArrayList<>(); 580 587 // Doing this cuts down search cost on a real-life data set by about 25% … … 583 590 } 584 591 // Walk back up the tree when the last search spot can not cover the current search 585 while (searchCache != null && !searchCache.bbox().bounds(search _bbox)) {592 while (searchCache != null && !searchCache.bbox().bounds(searchBbox)) { 586 593 searchCache = searchCache.parent; 587 594 } … … 589 596 if (searchCache == null) { 590 597 searchCache = root; 591 Main.info("bbox: " + search _bbox + " is out of the world");598 Main.info("bbox: " + searchBbox + " is out of the world"); 592 599 } 593 600 … … 595 602 QBLevel<T> tmp = searchCache.parent; 596 603 597 searchCache.search(search _bbox, ret);604 searchCache.search(searchBbox, ret); 598 605 599 606 // A way that spans this bucket may be stored in one 600 607 // of the nodes which is a parent of the search cache 601 608 while (tmp != null) { 602 tmp.search_contents(search _bbox, ret);609 tmp.search_contents(searchBbox, ret); 603 610 tmp = tmp.parent; 604 611 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r9802 r9854 33 33 import java.util.List; 34 34 import java.util.Map; 35 import java.util.NoSuchElementException; 35 36 import java.util.concurrent.ForkJoinPool; 36 37 import java.util.concurrent.ForkJoinTask; … … 94 95 * 95 96 * There is no intention, to handle consecutive duplicate Nodes in a 96 * perfect way, but it isshould not throw an exception.97 * perfect way, but it should not throw an exception. 97 98 */ 98 99 private class OffsetIterator implements Iterator<Point> { … … 122 123 @Override 123 124 public Point next() { 124 if (Math.abs(offset) < 0.1d) return nc.getPoint(nodes.get(idx++)); 125 if (!hasNext()) 126 throw new NoSuchElementException(); 127 128 if (Math.abs(offset) < 0.1d) 129 return nc.getPoint(nodes.get(idx++)); 125 130 126 131 Point current = nc.getPoint(nodes.get(idx)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r9603 r9854 22 22 import java.util.Map; 23 23 import java.util.Map.Entry; 24 import java.util.NoSuchElementException; 24 25 import java.util.Set; 25 26 import java.util.concurrent.locks.ReadWriteLock; … … 157 158 @Override 158 159 public boolean hasNext() { 159 return next >= 0 ;160 return next >= 0 && next < rules.size(); 160 161 } 161 162 162 163 @Override 163 164 public MapCSSRule next() { 165 if (!hasNext()) 166 throw new NoSuchElementException(); 164 167 MapCSSRule rule = rules.get(next); 165 168 next = ruleCandidates.nextSetBit(next + 1); -
trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java
r9484 r9854 5 5 import java.util.Iterator; 6 6 import java.util.List; 7 import java.util.NoSuchElementException; 7 8 8 9 import javax.swing.DefaultComboBoxModel; … … 79 80 @Override 80 81 public boolean hasNext() { 81 if (position < getSize()-1 && getSize() > 0) 82 return true; 83 return false; 82 return position < getSize()-1 && getSize() > 0; 84 83 } 85 84 86 85 @Override 87 86 public AutoCompletionListItem next() { 87 if (!hasNext()) 88 throw new NoSuchElementException(); 88 89 position++; 89 90 return getElementAt(position); -
trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java
r8836 r9854 5 5 import java.util.Collection; 6 6 import java.util.Iterator; 7 import java.util.NoSuchElementException; 7 8 8 9 /** … … 51 52 @Override 52 53 public T next() { 53 findNext(); 54 if (!hasNext()) 55 throw new NoSuchElementException(); 54 56 S old = current; 55 57 current = null;
Note:
See TracChangeset
for help on using the changeset viewer.