Changeset 8318 in josm
- Timestamp:
- 2015-05-03T18:34:33+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r7850 r8318 286 286 neighbors.add(nodes.get(i+1)); 287 287 } 288 if(neighbors. size() == 0)288 if(neighbors.isEmpty()) 289 289 continue; 290 290 else if(neighbors.size() == 2) -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r8308 r8318 121 121 } 122 122 } 123 if (tmpNodes. size() < 1) {123 if (tmpNodes.isEmpty()) { 124 124 if (selection.size() > 1) { 125 125 errMsg = tr("None of these nodes are glued to anything else."); … … 262 262 */ 263 263 private boolean checkSelection2(Collection<? extends OsmPrimitive> selection) { 264 if (selection. size() < 1)264 if (selection.isEmpty()) 265 265 return false; 266 266 … … 286 286 } 287 287 288 if (selectedNodes. size() < 1) {288 if (selectedNodes.isEmpty()) { 289 289 selectedNodes.addAll(selectedWay.getNodes()); 290 290 } -
trunk/src/org/openstreetmap/josm/actions/UploadNotesAction.java
r7937 r8318 36 36 } 37 37 NoteLayer layer; 38 if (noteLayers != null && noteLayers. size() > 0) {38 if (noteLayers != null && !noteLayers.isEmpty()) { 39 39 layer = noteLayers.get(0); 40 40 } else { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r8218 r8318 114 114 } 115 115 NoteLayer layer; 116 if (noteLayers != null && noteLayers. size() > 0) {116 if (noteLayers != null && !noteLayers.isEmpty()) { 117 117 layer = noteLayers.get(0); 118 118 layer.getNoteData().addNotes(notesData); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesUrlIdTask.java
r8240 r8318 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import org.openstreetmap.josm. gui.progress.ProgressMonitor;4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 6 import java.util.concurrent.Future; … … 8 8 import java.util.regex.Pattern; 9 9 10 import staticorg.openstreetmap.josm.tools.I18n.tr;10 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 11 11 12 12 public class DownloadNotesUrlIdTask extends DownloadNotesTask { … … 29 29 } 30 30 31 public boolean acceptsUrl(String url) {32 return super.acceptsUrl(url);33 }34 35 31 @Override 36 32 public String getTitle() { -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r8308 r8318 612 612 startImproving(wayList.get(0)); 613 613 return; 614 } else if (nodeList.size() > 0) {614 } else if (nodeList.size() == 1) { 615 615 // Starting improving the only way of the single selected node 616 if (nodeList.size() == 1) { 617 List<OsmPrimitive> r = nodeList.get(0).getReferrers(); 618 if (r.size() == 1 && (r.get(0) instanceof Way)) { 619 startImproving((Way) r.get(0)); 620 return; 621 } 616 List<OsmPrimitive> r = nodeList.get(0).getReferrers(); 617 if (r.size() == 1 && (r.get(0) instanceof Way)) { 618 startImproving((Way) r.get(0)); 619 return; 622 620 } 623 621 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r8308 r8318 519 519 // highlight it and adjust the cursor accordingly. 520 520 final boolean canMerge = ctrl && !getCurrentDataSet().getSelectedNodes().isEmpty(); 521 final OsmPrimitive p = canMerge ? (OsmPrimitive)findNodeToMergeTo(e.getPoint()) : null;521 final OsmPrimitive p = canMerge ? findNodeToMergeTo(e.getPoint()) : null; 522 522 boolean needsRepaint = removeHighlighting(); 523 523 if(p != null) { -
trunk/src/org/openstreetmap/josm/data/cache/CacheEntryAttributes.java
r8313 r8318 11 11 * 12 12 * @author Wiktor Niesiobędzki 13 * 13 * @since 8168 14 14 */ 15 15 public class CacheEntryAttributes extends ElementAttributes { 16 16 private static final long serialVersionUID = 1L; //version 17 private Map<String, String> attrs = new HashMap<String, String>(); 18 private final staticString NO_TILE_AT_ZOOM = "noTileAtZoom";19 private final staticString ETAG = "Etag";20 private final staticString LAST_MODIFICATION = "lastModification";21 private final staticString EXPIRATION_TIME = "expirationTime";17 private final Map<String, String> attrs = new HashMap<String, String>(); 18 private static final String NO_TILE_AT_ZOOM = "noTileAtZoom"; 19 private static final String ETAG = "Etag"; 20 private static final String LAST_MODIFICATION = "lastModification"; 21 private static final String EXPIRATION_TIME = "expirationTime"; 22 22 23 23 /** -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r8291 r8318 27 27 import org.openstreetmap.josm.data.preferences.IntegerProperty; 28 28 29 30 29 /** 31 30 * @author Wiktor Niesiobędzki … … 33 32 * Wrapper class for JCS Cache. Sets some sane environment and returns instances of cache objects. 34 33 * Static configuration for now assumes some small LRU cache in memory and larger LRU cache on disk 35 * 34 * @since 8168 36 35 */ 37 36 public class JCSCacheManager { … … 40 39 private static volatile CompositeCacheManager cacheManager = null; 41 40 private static long maxObjectTTL = Long.MAX_VALUE; 42 private final staticString PREFERENCE_PREFIX = "jcs.cache";43 private final staticIndexedDiskCacheFactory diskCacheFactory = new IndexedDiskCacheFactory();41 private static final String PREFERENCE_PREFIX = "jcs.cache"; 42 private static final IndexedDiskCacheFactory diskCacheFactory = new IndexedDiskCacheFactory(); 44 43 private static FileLock cacheDirLock = null; 45 44 -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r8314 r8318 43 43 * This class will keep only one Job running for specified tile. All others will just finish, but 44 44 * listeners will be gathered and notified, once download job will be finished 45 * 46 * @since 8168 45 47 */ 46 48 public abstract class JCSCachedTileLoaderJob<K, V extends CacheEntry> implements ICachedLoaderJob<K>, Runnable { … … 56 58 * maximum download threads that will be started 57 59 */ 58 public final staticIntegerProperty THREAD_LIMIT = new IntegerProperty("cache.jcs.max_threads", 10);60 public static final IntegerProperty THREAD_LIMIT = new IntegerProperty("cache.jcs.max_threads", 10); 59 61 60 62 public static class LIFOQueue extends LinkedBlockingDeque<Runnable> { -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r8314 r8318 32 32 * 33 33 * Class bridging TMS requests to JCS cache requests 34 * 34 * @since 8168 35 35 */ 36 36 public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener { … … 43 43 * Limit definition for per host concurrent connections 44 44 */ 45 public final staticIntegerProperty HOST_LIMIT = new IntegerProperty("imagery.tms.tmsloader.maxjobsperhost", 6);45 public static final IntegerProperty HOST_LIMIT = new IntegerProperty("imagery.tms.tmsloader.maxjobsperhost", 6); 46 46 47 47 /* … … 77 77 } 78 78 return ret; 79 80 79 } 81 80 … … 87 86 } 88 87 89 90 88 private static Map<String, Semaphore> HOST_LIMITS = new ConcurrentHashMap<>(); 91 89 … … 93 91 * overrides the THREAD_LIMIT in superclass, as we want to have separate limit and pool for TMS 94 92 */ 95 public final staticIntegerProperty THREAD_LIMIT = new IntegerProperty("imagery.tms.tmsloader.maxjobs", 25);93 public static final IntegerProperty THREAD_LIMIT = new IntegerProperty("imagery.tms.tmsloader.maxjobs", 25); 96 94 97 95 /** -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r8285 r8318 575 575 @Override 576 576 public boolean isEmpty() { 577 if (this.size() == 0) 578 return true; 579 return false; 577 return size == 0; 580 578 } 581 579 … … 583 581 List<T> ret = new ArrayList<>(); 584 582 // Doing this cuts down search cost on a real-life data set by about 25% 585 boolean cache_searches = true; 586 if (cache_searches) { 587 if (search_cache == null) { 588 search_cache = root; 589 } 590 // Walk back up the tree when the last search spot can not cover the current search 591 while (search_cache != null && !search_cache.bbox().bounds(search_bbox)) { 592 search_cache = search_cache.parent; 593 } 594 595 if (search_cache == null) { 596 search_cache = root; 597 Main.info("bbox: " + search_bbox + " is out of the world"); 598 } 599 } else { 583 if (search_cache == null) { 600 584 search_cache = root; 585 } 586 // Walk back up the tree when the last search spot can not cover the current search 587 while (search_cache != null && !search_cache.bbox().bounds(search_bbox)) { 588 search_cache = search_cache.parent; 589 } 590 591 if (search_cache == null) { 592 search_cache = root; 593 Main.info("bbox: " + search_bbox + " is out of the world"); 601 594 } 602 595 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r8291 r8318 1599 1599 1600 1600 private final List<StyleRecord> allStyleElems; 1601 private final DataSet data; 1602 1603 public ConcurrentTasksHelper(List<StyleRecord> allStyleElems, DataSet data) { 1601 1602 public ConcurrentTasksHelper(List<StyleRecord> allStyleElems) { 1604 1603 this.allStyleElems = allStyleElems; 1605 this.data = data;1606 1604 } 1607 1605 … … 1658 1656 final List<StyleRecord> allStyleElems = new ArrayList<>(nodes.size()+ways.size()+relations.size()); 1659 1657 1660 ConcurrentTasksHelper helper = new ConcurrentTasksHelper(allStyleElems , data);1658 ConcurrentTasksHelper helper = new ConcurrentTasksHelper(allStyleElems); 1661 1659 1662 1660 // Need to process all relations first. -
trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
r7937 r8318 47 47 Predicates.stringContainsPattern(Pattern.compile(":" + lanesKey + "$")))); 48 48 keysForPattern.removeAll(Arrays.asList(BLACKLIST)); 49 if (keysForPattern. size() < 1) {49 if (keysForPattern.isEmpty()) { 50 50 // nothing to check 51 51 return; -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r8285 r8318 144 144 * Represents a fix to a validation test. The fixing {@link Command} can be obtained by {@link #createCommand(OsmPrimitive, Selector)}. 145 145 */ 146 staticabstract class FixCommand {146 abstract static class FixCommand { 147 147 /** 148 148 * Creates the fixing {@link Command} for the given primitive. The {@code matchingSelector} is used to -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r8237 r8318 129 129 if (!w.isArea() && ElemStyles.hasOnlyAreaElemStyle(w)) { 130 130 List<Node> nodes = w.getNodes(); 131 if (nodes. size()<1) return; // fix zero nodes bug131 if (nodes.isEmpty()) return; // fix zero nodes bug 132 132 for (String key : keysCheckedByAnotherTest) { 133 133 if (w.hasKey(key)) { -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r8308 r8318 1016 1016 1017 1017 List<JMenuItem> searchResult = mainMenu.findMenuItems(currentSearchText); 1018 if(searchResult. size() == 0) {1018 if(searchResult.isEmpty()) { 1019 1019 // Nothing found 1020 1020 hideMenu(); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r8308 r8318 48 48 import org.openstreetmap.josm.data.osm.DataSet; 49 49 import org.openstreetmap.josm.data.osm.OsmPrimitive; 50 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;51 50 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 52 51 import org.openstreetmap.josm.data.osm.visitor.paint.relations.MultipolygonCache; … … 700 699 701 700 /** 702 * Set the new dimension to the view.703 *704 * @deprecated use #zoomTo(BoundingXYVisitor)705 */706 @Deprecated707 public void recalculateCenterScale(BoundingXYVisitor box) {708 zoomTo(box);709 }710 711 /**712 701 * @return An unmodifiable collection of all layers 713 702 */ … … 733 722 * @return an unmodifiable list of layers of a certain type. 734 723 */ 735 public <T extends Layer> List<T> 724 public <T extends Layer> List<T> getLayersOfType(Class<T> ofType) { 736 725 return new ArrayList<>(Utils.filteredCollection(getAllLayers(), ofType)); 737 726 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r8308 r8318 101 101 buildDialog(); 102 102 MapView.addLayerChangeListener(this); 103 }104 105 @Override106 public void showDialog() {107 super.showDialog();108 103 } 109 104 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r8308 r8318 580 580 581 581 public void updateTitle() { 582 if (relations. size() > 0&& relations.size() != getSize()) {582 if (!relations.isEmpty() && relations.size() != getSize()) { 583 583 RelationListDialog.this.setTitle(tr("Relations: {0}/{1}", getSize(), relations.size())); 584 584 } else if (getSize() > 0) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r8308 r8318 282 282 return false; 283 283 Arrays.sort(rows); 284 return rows[0] > 0 && members. size() > 0;284 return rows[0] > 0 && !members.isEmpty(); 285 285 } 286 286 … … 289 289 return false; 290 290 Arrays.sort(rows); 291 return members. size() > 0&& rows[rows.length - 1] < members.size() - 1;291 return !members.isEmpty() && rows[rows.length - 1] < members.size() - 1; 292 292 } 293 293 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r8308 r8318 328 328 private String searchExpression; 329 329 private HttpURLConnection connection; 330 private transientList<SearchResult> data;330 private List<SearchResult> data; 331 331 private boolean canceled = false; 332 332 private Server useserver; -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowserHistory.java
r7005 r8318 57 57 } else if (historyPos == history.size() -1) { 58 58 // do nothing just append 59 } else if (historyPos ==0 && history. size() > 0) {59 } else if (historyPos ==0 && !history.isEmpty()) { 60 60 history = new ArrayList<>(Collections.singletonList(history.get(0))); 61 61 } else if (historyPos < history.size() -1 && historyPos > 0) { -
trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java
r8285 r8318 109 109 referenceDiff.add(new Item(DiffItemType.EMPTY, null)); 110 110 currentDiff.add(new Item(DiffItemType.INSERTED, b[ib++])); 111 } else if(deleted > 0){111 } else { 112 112 referenceDiff.add(new Item(DiffItemType.DELETED, a[ia++])); 113 113 currentDiff.add(new Item(DiffItemType.EMPTY, null)); -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r8308 r8318 93 93 } 94 94 95 static public List<String> getDefaultSources() {95 public static List<String> getDefaultSources() { 96 96 return Arrays.asList("knowledge", "survey", "Bing"); 97 97 } -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r8291 r8318 1324 1324 continue; 1325 1325 } 1326 if (missedTiles. size() <= 0) {1326 if (missedTiles.isEmpty()) { 1327 1327 break; 1328 1328 } … … 1351 1351 missedTiles = newlyMissedTiles; 1352 1352 } 1353 if (Main.isDebugEnabled() && missedTiles. size() > 0) {1353 if (Main.isDebugEnabled() && !missedTiles.isEmpty()) { 1354 1354 Main.debug("still missed "+missedTiles.size()+" in the end"); 1355 1355 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r8308 r8318 999 999 1000 1000 // no images found, exit 1001 if(imgs. size() <= 0) {1001 if(imgs.isEmpty()) { 1002 1002 JOptionPane.showMessageDialog(Main.parent, 1003 1003 tr("The selected photos do not contain time information."), … … 1207 1207 // before the first point will be geotagged with the starting point 1208 1208 if (prevWpTime == 0 || curWpTime <= prevWpTime) { 1209 while (true) { 1210 if (i < 0) { 1211 break; 1212 } 1209 while (i >= 0) { 1213 1210 final ImageEntry curImg = images.get(i); 1214 1211 long time = curImg.getExifTime().getTime(); … … 1231 1228 // This code gives a simple linear interpolation of the coordinates between current and 1232 1229 // previous track point assuming a constant speed in between 1233 while (true) { 1234 if (i < 0) { 1235 break; 1236 } 1230 while (i >= 0) { 1237 1231 ImageEntry curImg = images.get(i); 1238 1232 long imgTime = curImg.getExifTime().getTime(); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r8285 r8318 713 713 714 714 public void showNextPhoto() { 715 if (data != null && data.size() > 0) {715 if (data != null && !data.isEmpty()) { 716 716 currentPhoto++; 717 717 if (currentPhoto >= data.size()) { … … 739 739 740 740 public void showFirstPhoto() { 741 if (data != null && data.size() > 0) {741 if (data != null && !data.isEmpty()) { 742 742 currentPhoto = 0; 743 743 ImageViewerDialog.showImage(this, data.get(currentPhoto)); … … 749 749 750 750 public void showLastPhoto() { 751 if (data != null && data.size() > 0) {751 if (data != null && !data.isEmpty()) { 752 752 currentPhoto = data.size() - 1; 753 753 ImageViewerDialog.showImage(this, data.get(currentPhoto)); … … 764 764 765 765 public void removeCurrentPhoto() { 766 if (data != null && data.size() > 0&& currentPhoto >= 0 && currentPhoto < data.size()) {766 if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) { 767 767 data.remove(currentPhoto); 768 768 if (currentPhoto >= data.size()) { … … 781 781 public void removeCurrentPhotoFromDisk() { 782 782 ImageEntry toDelete = null; 783 if (data != null && data.size() > 0&& currentPhoto >= 0 && currentPhoto < data.size()) {783 if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) { 784 784 toDelete = data.get(currentPhoto); 785 785 … … 828 828 public void copyCurrentPhotoPath() { 829 829 ImageEntry toCopy = null; 830 if (data != null && data.size() > 0&& currentPhoto >= 0 && currentPhoto < data.size()) {830 if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) { 831 831 toCopy = data.get(currentPhoto); 832 832 String copyString = toCopy.getFile().toString(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r7864 r8318 209 209 210 210 public void consistencyTest() { 211 if (bd.size() < 2) throw new AssertionError(); 212 if (data. size() < 1) throw new AssertionError();211 if (bd.size() < 2) throw new AssertionError(bd); 212 if (data.isEmpty()) throw new AssertionError(data); 213 213 if (bd.size() != data.size() + 1) throw new AssertionError(); 214 214 if (bd.get(0) != 0) throw new AssertionError(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r8297 r8318 175 175 * @author Michael Zangl 176 176 */ 177 private final staticclass MapCSSKeyRules {177 private static final class MapCSSKeyRules { 178 178 /** 179 179 * The indexes of rules that might be applied if this tag is present and the value has no special handling. -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r8308 r8318 1240 1240 class SourceLoader extends PleaseWaitRunnable { 1241 1241 private final String url; 1242 private final transientList<SourceProvider> sourceProviders;1242 private final List<SourceProvider> sourceProviders; 1243 1243 private BufferedReader reader; 1244 1244 private boolean canceled; -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java
r7937 r8318 64 64 public void setPreferences(Collection<String> args) { 65 65 String zone = null; 66 if (args != null && args.size() >= 1) {66 if (args != null && !args.isEmpty()) { 67 67 zone = args.iterator().next(); 68 68 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r8308 r8318 419 419 } 420 420 421 if (cmds. size() == 0)421 if (cmds.isEmpty()) 422 422 return null; 423 423 else if (cmds.size() == 1) -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitPane.java
r8308 r8318 145 145 * @see #setDividerPainter 146 146 */ 147 public abstract static classDividerPainter {147 public interface DividerPainter { 148 148 /** 149 149 * Paint a single Divider. … … 155 155 } 156 156 157 private class DefaultDividerPainter extends DividerPainter {157 private class DefaultDividerPainter implements DividerPainter { 158 158 @Override 159 159 public void paint(Graphics g, Divider divider) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r8221 r8318 60 60 String msg = tr("Remote Control has been asked to load data from the API.") + 61 61 "<br>" + tr("Bounding box: ") + new BBox(minlon, minlat, maxlon, maxlat).toStringCSV(", "); 62 if (args.containsKey("select") && toSelect. size() > 0) {62 if (args.containsKey("select") && !toSelect.isEmpty()) { 63 63 msg += "<br>" + tr("Selection: {0}", toSelect.size()); 64 64 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r8304 r8318 313 313 } 314 314 315 public staticabstract class RawURLParseRequestHandler extends RequestHandler {315 public abstract static class RawURLParseRequestHandler extends RequestHandler { 316 316 @Override 317 317 protected void parseArgs() {
Note:
See TracChangeset
for help on using the changeset viewer.