- Timestamp:
- 2020-11-29T10:33:58+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r17358 r17374 708 708 // see #9599 709 709 if (discardedWays.stream().anyMatch(w -> !w.isNew())) { 710 for (int i = 0; i < boundaries.size(); i++) { 711 AssembledPolygon ring = boundaries.get(i); 710 for (AssembledPolygon ring : boundaries) { 712 711 for (int k = 0; k < ring.ways.size(); k++) { 713 712 WayInPolygon ringWay = ring.ways.get(k); -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r17164 r17374 1124 1124 1125 1125 if (cyclePrims && shift) { 1126 for ( Iterator<OsmPrimitive> i =cycleList.iterator(); i.hasNext();) {1127 nxt = i.next();1126 for (OsmPrimitive osmPrimitive : cycleList) { 1127 nxt = osmPrimitive; 1128 1128 if (!nxt.isSelected()) { 1129 1129 break; // take first primitive in cycleList not in sel -
trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java
r15525 r17374 4 4 import java.io.IOException; 5 5 import java.net.URL; 6 import java.util.Iterator;7 6 import java.util.Map; 8 7 import java.util.concurrent.ConcurrentHashMap; … … 53 52 54 53 private JCSCachedTileLoaderJob<?, ?> findJob() { 55 for (Iterator<Runnable> it = iterator(); it.hasNext();) { 56 Runnable r = it.next(); 54 for (Runnable r : this) { 57 55 if (r instanceof JCSCachedTileLoaderJob) { 58 56 JCSCachedTileLoaderJob<?, ?> job = (JCSCachedTileLoaderJob<?, ?>) r; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r17333 r17374 263 263 private static NTV2SubGrid getSubGrid(NTV2SubGrid[] topLevelSubGrid, double lon, double lat) { 264 264 NTV2SubGrid sub = null; 265 for ( int i = 0; i <topLevelSubGrid.length; i++) {266 sub = topLevel SubGrid[i].getSubGridForCoord(lon, lat);265 for (NTV2SubGrid topLevel : topLevelSubGrid) { 266 sub = topLevel.getSubGridForCoord(lon, lat); 267 267 if (sub != null) { 268 268 break; … … 274 274 @Override 275 275 public String toString() { 276 return new StringBuilder(256) 277 .append("Headers : ") 278 .append(overviewHeaderCount) 279 .append("\nSub Hdrs : ") 280 .append(subGridHeaderCount) 281 .append("\nSub Grids: ") 282 .append(subGridCount) 283 .append("\nType : ") 284 .append(shiftType) 285 .append("\nVersion : ") 286 .append(version) 287 .append("\nFr Ellpsd: ") 288 .append(fromEllipsoid) 289 .append("\nTo Ellpsd: ") 290 .append(toEllipsoid) 291 .append("\nFr Maj Ax: ") 292 .append(fromSemiMajorAxis) 293 .append("\nFr Min Ax: ") 294 .append(fromSemiMinorAxis) 295 .append("\nTo Maj Ax: ") 296 .append(toSemiMajorAxis) 297 .append("\nTo Min Ax: ") 298 .append(toSemiMinorAxis) 299 .toString(); 276 char endl = '\n'; 277 return "Headers : " + overviewHeaderCount + endl + 278 "Sub Hdrs : " + subGridHeaderCount + endl + 279 "Sub Grids: " + subGridCount + endl + 280 "Type : " + shiftType + endl + 281 "Version : " + version + endl + 282 "Fr Ellpsd: " + fromEllipsoid + endl + 283 "To Ellpsd: " + toEllipsoid + endl + 284 "Fr Maj Ax: " + fromSemiMajorAxis + endl + 285 "Fr Min Ax: " + fromSemiMinorAxis + endl + 286 "To Maj Ax: " + toSemiMajorAxis + endl + 287 "To Min Ax: " + toSemiMinorAxis; 300 288 } 301 289 -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r13590 r17374 276 276 } 277 277 allowedSchemes = new HashSet<>(schemes.length); 278 for ( int i = 0; i <schemes.length; i++) {279 allowedSchemes.add(scheme s[i].toLowerCase(Locale.ENGLISH));278 for (String scheme : schemes) { 279 allowedSchemes.add(scheme.toLowerCase(Locale.ENGLISH)); 280 280 } 281 281 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConnectivityRelations.java
r16643 r17374 80 80 final String joined = cnTag.replace("bw", Integer.toString(BW)); 81 81 82 83 82 final Map<Integer, Map<Integer, Boolean>> result = new HashMap<>(); 84 83 String[] lanes = joined.split("\\|", -1); 85 84 for (int i = 0; i < lanes.length; i++) { 86 String[] lane = lanes[i].split(":", -1); 85 final String[] lane = lanes[i].split(":", -1); 87 86 int laneNumber; 88 87 //Ignore connections from bw, since we cannot derive a lane number from bw -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r17096 r17374 156 156 * Returns the list of "duplicate nodes" errors for the given selection of node and parent test 157 157 * @param parentTest The parent test of returned errors 158 * @param nodes The nodes selction to look into 158 * @param nodes The nodes selection to look into 159 159 * @return the list of "duplicate nodes" errors 160 160 */ … … 187 187 Way w = (Way) sp; 188 188 Map<String, String> keys = w.getKeys(); 189 for (Iterator<Entry<String, Boolean>> itt = typeMap.entrySet().iterator(); itt.hasNext();) { 190 Entry<String, Boolean> e = itt.next(); 189 for (Entry<String, Boolean> e : typeMap.entrySet()) { 191 190 if (keys.containsKey(e.getKey())) { 192 191 e.setValue(Boolean.TRUE); -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r15079 r17374 220 220 StringBuilder expression = new StringBuilder(); 221 221 int maxLength = 0; 222 for ( int i = 0; i < words.length; i++) {223 if (word s[i].length() > maxLength) {224 maxLength = word s[i].length();222 for (String word : words) { 223 if (word.length() > maxLength) { 224 maxLength = word.length(); 225 225 } 226 226 if (expression.length() > 0) { 227 227 expression.append('|'); 228 228 } 229 expression.append(Pattern.quote(word s[i]));229 expression.append(Pattern.quote(word)); 230 230 } 231 231 this.regExpr = Pattern.compile(expression.toString(), CASE_INSENSITIVE + UNICODE_CASE); … … 243 243 // which word matches? 244 244 String part = ""; 245 for (int i = 0; i < words.length; i++) { 246 String word = words[i]; 245 for (String word : words) { 247 246 if (start + word.length() <= name.length()) { 248 247 part = name.substring(start, start + word.length()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r17347 r17374 277 277 List<Command> undoCommands = UndoRedoHandler.getInstance().getUndoCommands(); 278 278 undoRoot = new DefaultMutableTreeNode(); 279 for ( int i = 0; i <undoCommands.size(); ++i) {280 undoRoot.add(getNodeForCommand(undoCommand s.get(i)));279 for (Command undoCommand : undoCommands) { 280 undoRoot.add(getNodeForCommand(undoCommand)); 281 281 } 282 282 undoTreeModel.setRoot(undoRoot); … … 286 286 List<Command> redoCommands = UndoRedoHandler.getInstance().getRedoCommands(); 287 287 redoRoot = new DefaultMutableTreeNode(); 288 for ( int i = 0; i <redoCommands.size(); ++i) {289 redoRoot.add(getNodeForCommand(redoCommand s.get(i)));288 for (Command redoCommand : redoCommands) { 289 redoRoot.add(getNodeForCommand(redoCommand)); 290 290 } 291 291 redoTreeModel.setRoot(redoRoot); … … 341 341 if (c.getChildren() != null) { 342 342 List<PseudoCommand> children = new ArrayList<>(c.getChildren()); 343 for ( int i = 0; i <children.size(); ++i) {344 node.add(getNodeForCommand(child ren.get(i)));343 for (PseudoCommand child : children) { 344 node.add(getNodeForCommand(child)); 345 345 } 346 346 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r16438 r17374 194 194 */ 195 195 if (action == Action.RESTORE_SAVED || action == Action.ELEMENT_SHRINKS) { 196 for (int i = 0; i < n; ++i) { 197 final ToggleDialog dlg = allDialogs.get(i); 196 for (final ToggleDialog dlg : allDialogs) { 198 197 if (dlg.isDialogInDefaultView()) { 199 198 final int ph = action == Action.RESTORE_SAVED ? dlg.getLastHeight() : dlg.getPreferredHeight(); … … 251 250 int dm = 0; // additional space needed by the small dialogs 252 251 int dp = 0; // available space from the large dialogs 253 for (int i = 0; i < n; ++i) { 254 final ToggleDialog dlg = allDialogs.get(i); 252 for (final ToggleDialog dlg : allDialogs) { 255 253 if (dlg != triggeredBy && dlg.isDialogInDefaultView()) { 256 254 final int ha = dlg.getSize().height; // current … … 266 264 } 267 265 /** adjust, without changing the sum */ 268 for (int i = 0; i < n; ++i) { 269 final ToggleDialog dlg = allDialogs.get(i); 266 for (final ToggleDialog dlg : allDialogs) { 270 267 if (dlg != triggeredBy && dlg.isDialogInDefaultView()) { 271 268 final int ha = dlg.getHeight(); … … 276 273 dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, hn)); 277 274 } else { 278 int d = dp == 0 ? 0 : ((h0 -he) * dm / dp);275 int d = dp == 0 ? 0 : ((h0 - he) * dm / dp); 279 276 dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, h0 - d)); 280 277 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java
r16488 r17374 40 40 // Centroids are not optimal either, just imagine a U-shaped house. 41 41 42 Rectangle pb = path.getBounds(); 42 final Rectangle pb = path.getBounds(); 43 43 44 44 // quick check to see if label box is smaller than primitive box … … 56 56 final int nbh = (int) nb.getHeight(); 57 57 58 Rectangle centeredNBounds = new Rectangle(x2, y2, nbw, nbh); 58 final Rectangle centeredNBounds = new Rectangle(x2, y2, nbw, nbh); 59 59 60 60 // slower check to see if label is displayed inside primitive shape … … 85 85 // Dumb algorithm to find a better placement. We could surely find a smarter one but it should 86 86 // solve most of building issues with only few calculations (8 at most) 87 for (int i = 0; i < candidates.length; i++) { 88 centeredNBounds = candidates[i]; 89 if (path.contains(centeredNBounds)) { 90 return centerOf(path.getMapViewState(), centeredNBounds); 87 for (Rectangle candidate : candidates) { 88 if (path.contains(candidate)) { 89 return centerOf(path.getMapViewState(), candidate); 91 90 } 92 91 } -
trunk/src/org/openstreetmap/josm/tools/ListenerList.java
r15726 r17374 5 5 import java.text.MessageFormat; 6 6 import java.util.HashMap; 7 import java.util.Iterator;8 7 import java.util.Objects; 9 8 import java.util.concurrent.CopyOnWriteArrayList; … … 156 155 eventFirerer.fire(l); 157 156 } 158 for (Iterator<WeakListener<T>> iterator = weakListeners.iterator(); iterator.hasNext();) { 159 WeakListener<T> weakLink = iterator.next(); 157 for (WeakListener<T> weakLink : weakListeners) { 160 158 T l = weakLink.listener.get(); 161 159 if (l != null) { -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r16955 r17374 1510 1510 } 1511 1511 Bidi.reorderVisually(levels, 0, dirStrings, 0, levels.length); 1512 for ( int i = 0; i <dirStrings.length; ++i) {1513 char[] chars = dirString s[i].str.toCharArray();1514 gvs.add(font.layoutGlyphVector(frc, chars, 0, chars.length, dirString s[i].direction));1512 for (DirectionString dirString : dirStrings) { 1513 char[] chars = dirString.str.toCharArray(); 1514 gvs.add(font.layoutGlyphVector(frc, chars, 0, chars.length, dirString.direction)); 1515 1515 } 1516 1516 return gvs;
Note:
See TracChangeset
for help on using the changeset viewer.