Changeset 6156 in josm
- Timestamp:
- 2013-08-19T15:10:53+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r6130 r6156 42 42 /** 43 43 * Combines multiple ways into one. 44 * 44 * @since 213 45 45 */ 46 46 public class CombineWayAction extends JosmAction { … … 48 48 private static final BooleanProperty PROP_REVERSE_WAY = new BooleanProperty("tag-correction.reverse-way", true); 49 49 50 /** 51 * Constructs a new {@code CombineWayAction}. 52 */ 50 53 public CombineWayAction() { 51 54 super(tr("Combine Way"), "combineway", tr("Combine several ways into one."), … … 123 126 List<Way> unreversedWays = new LinkedList<Way>(); 124 127 for (Way w: ways) { 125 if ((path.indexOf(w.getNode(0)) + 1) == path.lastIndexOf(w.getNode(1))) { 128 // Treat zero or one-node ways as unreversed as Combine action action is a good way to fix them (see #8971) 129 if (w.getNodesCount() < 2 || (path.indexOf(w.getNode(0)) + 1) == path.lastIndexOf(w.getNode(1))) { 126 130 unreversedWays.add(w); 127 131 } else { … … 247 251 } 248 252 253 /** 254 * A pair of nodes. 255 */ 249 256 static public class NodePair { 250 private Node a; 251 private Node b; 257 private final Node a; 258 private final Node b; 259 260 /** 261 * Constructs a new {@code NodePair}. 262 * @param a The first node 263 * @param b The second node 264 */ 252 265 public NodePair(Node a, Node b) { 253 this.a =a; 266 this.a = a; 254 267 this.b = b; 255 268 } 256 269 270 /** 271 * Constructs a new {@code NodePair}. 272 * @param pair An existing {@code Pair} of nodes 273 */ 257 274 public NodePair(Pair<Node,Node> pair) { 258 this.a = pair.a; 259 this.b = pair.b; 260 } 261 275 this(pair.a, pair.b); 276 } 277 278 /** 279 * Constructs a new {@code NodePair}. 280 * @param other An existing {@code NodePair} 281 */ 262 282 public NodePair(NodePair other) { 263 this.a = other.a; 264 this.b = other.b; 265 } 266 283 this(other.a, other.b); 284 } 285 286 /** 287 * Replies the first node. 288 * @return The first node 289 */ 267 290 public Node getA() { 268 291 return a; 269 292 } 270 293 294 /** 295 * Replies the second node 296 * @return The second node 297 */ 271 298 public Node getB() { 272 299 return b; … … 304 331 } 305 332 333 /** 334 * Determines if this pair contains the given node. 335 * @param n The node to look for 336 * @return {@code true} if {@code n} is in the pair, {@code false} otherwise 337 */ 306 338 public boolean contains(Node n) { 307 339 return a == n || b == n; … … 316 348 return result; 317 349 } 350 318 351 @Override 319 352 public boolean equals(Object obj) { … … 458 491 } 459 492 493 /** 494 * Constructs a new {@code NodeGraph}. 495 */ 460 496 public NodeGraph() { 461 497 edges = new LinkedHashSet<NodePair>(); -
trunk/src/org/openstreetmap/josm/tools/Pair.java
r4272 r6156 4 4 5 5 /** 6 * A pair. 6 * A pair of objects. 7 * @param <A> Type of first item 8 * @param <B> Type of second item 9 * @since 429 7 10 */ 8 11 public final class Pair<A,B> { 12 13 /** 14 * The first item 15 */ 9 16 public A a; 17 18 /** 19 * The second item 20 */ 10 21 public B b; 11 22 23 /** 24 * Constructs a new {@code Pair}. 25 * @param a The first item 26 * @param b The second item 27 */ 12 28 public Pair(A a, B b) { 13 29 this.a = a; … … 48 64 } 49 65 50 /* convenience constructor method */ 66 /** 67 * Convenient constructor method 68 * @param u The first item 69 * @param v The second item 70 * @return The newly created Pair(u,v) 71 */ 51 72 public static <U,V> Pair<U,V> create(U u, V v) { 52 73 return new Pair<U,V>(u,v);
Note:
See TracChangeset
for help on using the changeset viewer.