Changeset 10656 in josm
- Timestamp:
- 2016-07-27T01:09:02+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r10626 r10656 1033 1033 if (ref instanceof Relation && !ref.isIncomplete() && !ref.isDeleted()) { 1034 1034 for (RelationMember m : ((Relation) ref).getMembers()) { 1035 if ( m.getMember() == osm) {1035 if (osm.equals(m.getMember())) { 1036 1036 String testRole = m.getRole(); 1037 1037 if (role.equals(testRole == null ? "" : testRole)) -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r10611 r10656 17 17 import java.util.Locale; 18 18 import java.util.Map; 19 import java.util.Objects; 19 20 import java.util.Set; 20 21 … … 1004 1005 /** 1005 1006 * Add new referrer. If referrer is already included then no action is taken 1006 * @param referrer The referrer to add 1007 * @param referrer The referrer to add. Must not be null 1008 * @throws NullPointerException if {@code referrer} is null 1007 1009 */ 1008 1010 protected void addReferrer(OsmPrimitive referrer) { … … 1010 1012 referrers = referrer; 1011 1013 } else if (referrers instanceof OsmPrimitive) { 1012 if ( referrers != referrer) {1014 if (!referrer.equals(referrers)) { 1013 1015 referrers = new OsmPrimitive[] {(OsmPrimitive) referrers, referrer}; 1014 1016 } 1015 1017 } else { 1016 1018 for (OsmPrimitive primitive:(OsmPrimitive[]) referrers) { 1017 if ( primitive == referrer)1019 if (referrer.equals(primitive)) 1018 1020 return; 1019 1021 } … … 1024 1026 /** 1025 1027 * Remove referrer. No action is taken if referrer is not registered 1026 * @param referrer The referrer to remove 1028 * @param referrer The referrer to remove. Must not be null 1029 * @throws NullPointerException if {@code referrer} is null 1027 1030 */ 1028 1031 protected void removeReferrer(OsmPrimitive referrer) { 1029 1032 if (referrers instanceof OsmPrimitive) { 1030 if (referrer s == referrer) {1033 if (referrer.equals(referrers)) { 1031 1034 referrers = null; 1032 1035 } … … 1035 1038 int idx = -1; 1036 1039 for (int i = 0; i < orig.length; i++) { 1037 if ( orig[i] == referrer) {1040 if (referrer.equals(orig[i])) { 1038 1041 idx = i; 1039 1042 break; … … 1263 1266 && version == other.version 1264 1267 && isVisible() == other.isVisible() 1265 && (user == null ? other.user == null : user ==other.user)1268 && Objects.equals(user, other.user) 1266 1269 && changesetId == other.changesetId; 1267 1270 } -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r10632 r10656 9 9 import java.util.List; 10 10 import java.util.Map; 11 import java.util.Objects; 11 12 import java.util.Set; 12 13 … … 115 116 RelationMember originalMember = members[index]; 116 117 members[index] = member; 117 if ( originalMember.getMember() != member.getMember()) {118 if (!Objects.equals(originalMember.getMember(), member.getMember())) { 118 119 member.getMember().addReferrer(this); 119 120 member.getMember().clearCachedStyle(); -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r9371 r10656 161 161 */ 162 162 public boolean refersTo(OsmPrimitive primitive) { 163 return member == primitive;163 return Objects.equals(member, primitive); 164 164 } 165 165 … … 175 175 RelationMember that = (RelationMember) obj; 176 176 return Objects.equals(role, that.role) && 177 177 Objects.equals(member, that.member); 178 178 } 179 179 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r10632 r10656 9 9 import java.util.List; 10 10 import java.util.Map; 11 import java.util.Objects; 11 12 import java.util.Set; 12 13 … … 88 89 for (int i = 0; i < count && count > 2;) { 89 90 Node n = nodes.get(i); 90 if ( last == n) {91 if (Objects.equals(last, n)) { 91 92 nodes.remove(i); 92 93 --count; … … 361 362 boolean locked = writeLock(); 362 363 try { 363 boolean closed = lastNode() == n && firstNode() == n;364 boolean closed = Objects.equals(lastNode(), n) && Objects.equals(firstNode(), n); 364 365 int i; 365 366 List<Node> copy = getNodes(); … … 370 371 if (closed && i > 2) { 371 372 copy.add(copy.get(0)); 372 } else if (i >= 2 && i <= 3 && copy.get(0) == copy.get(i-1)) {373 } else if (i >= 2 && i <= 3 && Objects.equals(copy.get(0), copy.get(i-1))) { 373 374 copy.remove(i-1); 374 375 } … … 401 402 if (closed && i > 2) { 402 403 copy.add(copy.get(0)); 403 } else if (i >= 2 && i <= 3 && copy.get(0) == copy.get(i-1)) {404 } else if (i >= 2 && i <= 3 && Objects.equals(copy.get(0), copy.get(i-1))) { 404 405 copy.remove(i-1); 405 406 } … … 494 495 495 496 Node[] nodes = this.nodes; 496 return nodes.length >= 3 && nodes[nodes.length-1] == nodes[0];497 return nodes.length >= 3 && Objects.equals(nodes[nodes.length-1], nodes[0]); 497 498 } 498 499 … … 507 508 Node distinctNode = null; 508 509 for (int i = 1; i < nodes.length-1; i++) { 509 if (distinctNode == null && nodes[i] != nodes[0]) {510 if (distinctNode == null && !Objects.equals(nodes[i], nodes[0])) { 510 511 distinctNode = nodes[i]; 511 } else if (distinctNode != null && nodes[i] != nodes[0] && nodes[i] != distinctNode) {512 } else if (distinctNode != null && !Objects.equals(nodes[i], nodes[0]) && !Objects.equals(nodes[i], distinctNode)) { 512 513 return true; 513 514 } … … 550 551 Node[] nodes = this.nodes; 551 552 if (isIncomplete() || nodes.length == 0) return false; 552 return n == nodes[0] || n == nodes[nodes.length -1];553 return Objects.equals(n, nodes[0]) || Objects.equals(n, nodes[nodes.length -1]); 553 554 } 554 555 … … 563 564 if (isIncomplete() || nodes.length <= 2) return false; 564 565 /* circular ways have only inner nodes, so return true for them! */ 565 if ( n == nodes[0] && n == nodes[nodes.length-1]) return true;566 if (Objects.equals(n, nodes[0]) && Objects.equals(n, nodes[nodes.length-1])) return true; 566 567 for (int i = 1; i < nodes.length - 1; ++i) { 567 if ( nodes[i] == n) return true;568 if (Objects.equals(nodes[i], n)) return true; 568 569 } 569 570 return false; -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java
r10632 r10656 8 8 import java.util.Date; 9 9 import java.util.List; 10 import java.util.Objects; 10 11 11 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 137 138 */ 138 139 public boolean isClosed() { 139 return getNumNodes() >= 3 && nodeIds.get(0) == nodeIds.get(nodeIds.size()-1);140 return getNumNodes() >= 3 && Objects.equals(nodeIds.get(0), nodeIds.get(nodeIds.size()-1)); 140 141 } 141 142 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
r10655 r10656 3 3 4 4 import java.awt.Color; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.Main; … … 83 84 taggedColor = PaintColors.TAGGED.get(); 84 85 connectionColor = PaintColors.CONNECTION.get(); 85 if ( taggedColor != nodeColor) {86 if (!Objects.equals(taggedColor, nodeColor)) { 86 87 taggedConnectionColor = taggedColor; 87 88 } else { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r10626 r10656 34 34 import java.util.Map; 35 35 import java.util.NoSuchElementException; 36 import java.util.Objects; 36 37 import java.util.concurrent.ForkJoinPool; 37 38 import java.util.concurrent.ForkJoinTask; … … 226 227 227 228 // simple node on top of icons and shapes 228 if ( this.style == NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style != NodeElement.SIMPLE_NODE_ELEMSTYLE)229 if (NodeElement.SIMPLE_NODE_ELEMSTYLE.equals(this.style) && !NodeElement.SIMPLE_NODE_ELEMSTYLE.equals(other.style)) 229 230 return 1; 230 if ( this.style != NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style == NodeElement.SIMPLE_NODE_ELEMSTYLE)231 if (!NodeElement.SIMPLE_NODE_ELEMSTYLE.equals(this.style) && NodeElement.SIMPLE_NODE_ELEMSTYLE.equals(other.style)) 231 232 return -1; 232 233 … … 1146 1147 /* find the "direct" nodes before the via node */ 1147 1148 Node fromNode; 1148 if ( fromWay.firstNode() == via) {1149 if (Objects.equals(fromWay.firstNode(), via)) { 1149 1150 fromNode = fromWay.getNode(1); 1150 1151 } else { … … 1441 1442 GeneralPath highlightSegs = null; 1442 1443 for (WaySegment ws : highlightWaySegments) { 1443 if ( ws.way != way|| ws.lowerIndex < offset) {1444 if (!Objects.equals(ws.way, way) || ws.lowerIndex < offset) { 1444 1445 continue; 1445 1446 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r10378 r10656 11 11 import java.util.Iterator; 12 12 import java.util.List; 13 import java.util.Objects; 13 14 import java.util.Set; 14 15 … … 298 299 } 299 300 } 300 if (nodes.size() >= 3 && nodes.get(0) == nodes.get(nodes.size() - 1)) {301 if (nodes.size() >= 3 && Objects.equals(nodes.get(0), nodes.get(nodes.size() - 1))) { 301 302 poly.closePath(); 302 303 } … … 548 549 if (nodes == null) { 549 550 nl = w.getNodesCount()-1; 550 if ( w.getNode(nl) == c.getNode(0)) {551 if (Objects.equals(w.getNode(nl), c.getNode(0))) { 551 552 mode = 21; 552 } else if ( w.getNode(nl) == c.getNode(cl)) {553 } else if (Objects.equals(w.getNode(nl), c.getNode(cl))) { 553 554 mode = 22; 554 } else if ( w.getNode(0) == c.getNode(0)) {555 } else if (Objects.equals(w.getNode(0), c.getNode(0))) { 555 556 mode = 11; 556 } else if ( w.getNode(0) == c.getNode(cl)) {557 } else if (Objects.equals(w.getNode(0), c.getNode(cl))) { 557 558 mode = 12; 558 559 } 559 560 } else { 560 561 nl = nodes.size()-1; 561 if ( nodes.get(nl) == c.getNode(0)) {562 if (Objects.equals(nodes.get(nl), c.getNode(0))) { 562 563 mode = 21; 563 } else if ( nodes.get(0) == c.getNode(cl)) {564 } else if (Objects.equals(nodes.get(0), c.getNode(cl))) { 564 565 mode = 12; 565 } else if ( nodes.get(0) == c.getNode(0)) {566 } else if (Objects.equals(nodes.get(0), c.getNode(0))) { 566 567 mode = 11; 567 } else if ( nodes.get(nl) == c.getNode(cl)) {568 } else if (Objects.equals(nodes.get(nl), c.getNode(cl))) { 568 569 mode = 22; 569 570 } -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r10627 r10656 15 15 import java.util.LinkedHashSet; 16 16 import java.util.List; 17 import java.util.Objects; 17 18 import java.util.Set; 18 19 … … 115 116 int commonCount = 0; 116 117 //test if we have common nodes to add. 117 if ( seg1Node1 == seg2Node1 || seg1Node1 == seg2Node2) {118 if (Objects.equals(seg1Node1, seg2Node1) || Objects.equals(seg1Node1, seg2Node2)) { 118 119 commonCount++; 119 120 … … 127 128 } 128 129 129 if ( seg1Node2 == seg2Node1 || seg1Node2 == seg2Node2) {130 if (Objects.equals(seg1Node2, seg2Node1) || Objects.equals(seg1Node2, seg2Node2)) { 130 131 commonCount++; 131 132 … … 189 190 intersectionNodes.add(intNode); 190 191 191 if ( intNode == newNode) {192 if (Objects.equals(intNode, newNode)) { 192 193 cmds.add(new AddCommand(intNode)); 193 194 } … … 702 703 public static boolean isClockwise(List<Node> nodes) { 703 704 int nodesCount = nodes.size(); 704 if (nodesCount < 3 || nodes.get(0) != nodes.get(nodesCount - 1)) {705 if (nodesCount < 3 || !Objects.equals(nodes.get(0), nodes.get(nodesCount - 1))) { 705 706 throw new IllegalArgumentException("Way must be closed to check orientation."); 706 707 } … … 990 991 double perimeter = 0; 991 992 if (!nodes.isEmpty()) { 992 boolean closed = nodes.get(0) == nodes.get(nodes.size() - 1);993 boolean closed = Objects.equals(nodes.get(0), nodes.get(nodes.size() - 1)); 993 994 int numSegments = closed ? nodes.size() - 1 : nodes.size(); 994 995 EastNorth p1 = projection == null ? nodes.get(0).getEastNorth() : projection.latlon2eastNorth(nodes.get(0).getCoor());
Note:
See TracChangeset
for help on using the changeset viewer.