Changeset 9371 in josm for trunk/src/org
- Timestamp:
- 2016-01-09T23:20:37+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 83 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r9070 r9371 16 16 import java.util.List; 17 17 import java.util.Map; 18 import java.util.Objects; 18 19 import java.util.Set; 19 20 import java.util.Stack; … … 343 344 @Override 344 345 public int hashCode() { 345 final int prime = 31; 346 int result = 1; 347 result = prime * result + ((a == null) ? 0 : a.hashCode()); 348 result = prime * result + ((b == null) ? 0 : b.hashCode()); 349 return result; 346 return Objects.hash(a, b); 350 347 } 351 348 352 349 @Override 353 350 public boolean equals(Object obj) { 354 if (this == obj) 355 return true; 356 if (obj == null) 357 return false; 358 if (getClass() != obj.getClass()) 359 return false; 360 NodePair other = (NodePair) obj; 361 if (a == null) { 362 if (other.a != null) 363 return false; 364 } else if (!a.equals(other.a)) 365 return false; 366 if (b == null) { 367 if (other.b != null) 368 return false; 369 } else if (!b.equals(other.b)) 370 return false; 371 return true; 351 if (this == obj) return true; 352 if (obj == null || getClass() != obj.getClass()) return false; 353 NodePair nodePair = (NodePair) obj; 354 return Objects.equals(a, nodePair.a) && 355 Objects.equals(b, nodePair.b); 372 356 } 373 357 } -
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r8895 r9371 11 11 import java.util.LinkedList; 12 12 import java.util.List; 13 import java.util.Objects; 13 14 import java.util.ServiceConfigurationError; 14 15 … … 350 351 @Override 351 352 public int hashCode() { 352 final int prime = 31; 353 int result = 1; 354 result = prime * result + ((defaultExtension == null) ? 0 : defaultExtension.hashCode()); 355 result = prime * result + ((description == null) ? 0 : description.hashCode()); 356 result = prime * result + ((extensions == null) ? 0 : extensions.hashCode()); 357 return result; 353 return Objects.hash(extensions, description, defaultExtension); 358 354 } 359 355 360 356 @Override 361 357 public boolean equals(Object obj) { 362 if (this == obj) 363 return true; 364 if (obj == null) 365 return false; 366 if (getClass() != obj.getClass()) 367 return false; 368 ExtensionFileFilter other = (ExtensionFileFilter) obj; 369 if (defaultExtension == null) { 370 if (other.defaultExtension != null) 371 return false; 372 } else if (!defaultExtension.equals(other.defaultExtension)) 373 return false; 374 if (description == null) { 375 if (other.description != null) 376 return false; 377 } else if (!description.equals(other.description)) 378 return false; 379 if (extensions == null) { 380 if (other.extensions != null) 381 return false; 382 } else if (!extensions.equals(other.extensions)) 383 return false; 384 return true; 358 if (this == obj) return true; 359 if (obj == null || getClass() != obj.getClass()) return false; 360 ExtensionFileFilter that = (ExtensionFileFilter) obj; 361 return Objects.equals(extensions, that.extensions) && 362 Objects.equals(description, that.description) && 363 Objects.equals(defaultExtension, that.defaultExtension); 385 364 } 386 365 } -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r9295 r9371 17 17 import java.util.List; 18 18 import java.util.Map; 19 import java.util.Objects; 19 20 import java.util.Set; 20 21 import java.util.TreeMap; … … 92 93 @Override 93 94 public int hashCode() { 94 return rel.hashCode();95 return Objects.hash(rel, role); 95 96 } 96 97 97 98 @Override 98 99 public boolean equals(Object other) { 99 if (!(other instanceof RelationRole)) return false; 100 RelationRole otherMember = (RelationRole) other; 101 return otherMember.role.equals(role) && otherMember.rel.equals(rel); 100 if (this == other) return true; 101 if (other == null || getClass() != other.getClass()) return false; 102 RelationRole that = (RelationRole) other; 103 return Objects.equals(rel, that.rel) && 104 Objects.equals(role, that.role); 102 105 } 103 106 } … … 120 123 @Override 121 124 public int hashCode() { 122 return way.hashCode();125 return Objects.hash(way, insideToTheRight); 123 126 } 124 127 125 128 @Override 126 129 public boolean equals(Object other) { 127 if (!(other instanceof WayInPolygon)) return false; 128 WayInPolygon otherMember = (WayInPolygon) other; 129 return otherMember.way.equals(this.way) && otherMember.insideToTheRight == this.insideToTheRight; 130 if (this == other) return true; 131 if (other == null || getClass() != other.getClass()) return false; 132 WayInPolygon that = (WayInPolygon) other; 133 return insideToTheRight == that.insideToTheRight && 134 Objects.equals(way, that.way); 130 135 } 131 136 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r9079 r9371 24 24 import java.util.List; 25 25 import java.util.Map; 26 import java.util.Objects; 26 27 import java.util.Set; 27 28 … … 677 678 @Override 678 679 public boolean equals(Object other) { 679 if ( !(other instanceof SearchSetting))680 681 SearchSetting o= (SearchSetting) other;682 return o.caseSensitive == this.caseSensitive683 && o.regexSearch == this.regexSearch684 && o.mapCSSSearch == this.mapCSSSearch685 && o.allElements == this.allElements686 && o.mode.equals(this.mode)687 && o.text.equals(this.text);680 if (this == other) return true; 681 if (other == null || getClass() != other.getClass()) return false; 682 SearchSetting that = (SearchSetting) other; 683 return caseSensitive == that.caseSensitive && 684 regexSearch == that.regexSearch && 685 mapCSSSearch == that.mapCSSSearch && 686 allElements == that.allElements && 687 Objects.equals(text, that.text) && 688 mode == that.mode; 688 689 } 689 690 690 691 @Override 691 692 public int hashCode() { 692 return text.hashCode();693 return Objects.hash(text, mode, caseSensitive, regexSearch, mapCSSSearch, allElements); 693 694 } 694 695 -
trunk/src/org/openstreetmap/josm/command/AddCommand.java
r8510 r9371 7 7 import java.util.Collection; 8 8 import java.util.Collections; 9 import java.util.Objects; 9 10 10 11 import javax.swing.Icon; … … 99 100 @Override 100 101 public int hashCode() { 101 final int prime = 31; 102 int result = super.hashCode(); 103 result = prime * result + ((osm == null) ? 0 : osm.hashCode()); 104 return result; 102 return Objects.hash(super.hashCode(), osm); 105 103 } 106 104 107 105 @Override 108 106 public boolean equals(Object obj) { 109 if (this == obj) 110 return true; 111 if (!super.equals(obj)) 112 return false; 113 if (getClass() != obj.getClass()) 114 return false; 115 AddCommand other = (AddCommand) obj; 116 if (osm == null) { 117 if (other.osm != null) 118 return false; 119 } else if (!osm.equals(other.osm)) 120 return false; 121 return true; 107 if (this == obj) return true; 108 if (obj == null || getClass() != obj.getClass()) return false; 109 if (!super.equals(obj)) return false; 110 AddCommand that = (AddCommand) obj; 111 return Objects.equals(osm, that.osm); 122 112 } 123 113 } -
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r8840 r9371 8 8 import java.util.HashSet; 9 9 import java.util.List; 10 import java.util.Objects; 10 11 11 12 import javax.swing.Icon; … … 176 177 @Override 177 178 public int hashCode() { 178 final int prime = 31; 179 int result = super.hashCode(); 180 result = prime * result + ((createdPrimitives == null) ? 0 : createdPrimitives.hashCode()); 181 result = prime * result + ((createdPrimitivesToSelect == null) ? 0 : createdPrimitivesToSelect.hashCode()); 182 result = prime * result + ((data == null) ? 0 : data.hashCode()); 183 result = prime * result + ((toSelect == null) ? 0 : toSelect.hashCode()); 184 return result; 179 return Objects.hash(super.hashCode(), data, toSelect, createdPrimitives, createdPrimitivesToSelect); 185 180 } 186 181 187 182 @Override 188 183 public boolean equals(Object obj) { 189 if (this == obj) 190 return true; 191 if (!super.equals(obj)) 192 return false; 193 if (getClass() != obj.getClass()) 194 return false; 195 AddPrimitivesCommand other = (AddPrimitivesCommand) obj; 196 if (createdPrimitives == null) { 197 if (other.createdPrimitives != null) 198 return false; 199 } else if (!createdPrimitives.equals(other.createdPrimitives)) 200 return false; 201 if (createdPrimitivesToSelect == null) { 202 if (other.createdPrimitivesToSelect != null) 203 return false; 204 } else if (!createdPrimitivesToSelect.equals(other.createdPrimitivesToSelect)) 205 return false; 206 if (data == null) { 207 if (other.data != null) 208 return false; 209 } else if (!data.equals(other.data)) 210 return false; 211 if (toSelect == null) { 212 if (other.toSelect != null) 213 return false; 214 } else if (!toSelect.equals(other.toSelect)) 215 return false; 216 return true; 184 if (this == obj) return true; 185 if (obj == null || getClass() != obj.getClass()) return false; 186 if (!super.equals(obj)) return false; 187 AddPrimitivesCommand that = (AddPrimitivesCommand) obj; 188 return Objects.equals(data, that.data) && 189 Objects.equals(toSelect, that.toSelect) && 190 Objects.equals(createdPrimitives, that.createdPrimitives) && 191 Objects.equals(createdPrimitivesToSelect, that.createdPrimitivesToSelect); 217 192 } 218 193 } -
trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
r8510 r9371 6 6 7 7 import java.util.Collection; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 91 92 @Override 92 93 public int hashCode() { 93 final int prime = 31; 94 int result = super.hashCode(); 95 result = prime * result + ((newOsm == null) ? 0 : newOsm.hashCode()); 96 result = prime * result + ((osm == null) ? 0 : osm.hashCode()); 97 return result; 94 return Objects.hash(super.hashCode(), osm, newOsm); 98 95 } 99 96 100 97 @Override 101 98 public boolean equals(Object obj) { 102 if (this == obj) 103 return true; 104 if (!super.equals(obj)) 105 return false; 106 if (getClass() != obj.getClass()) 107 return false; 108 ChangeCommand other = (ChangeCommand) obj; 109 if (newOsm == null) { 110 if (other.newOsm != null) 111 return false; 112 } else if (!newOsm.equals(other.newOsm)) 113 return false; 114 if (osm == null) { 115 if (other.osm != null) 116 return false; 117 } else if (!osm.equals(other.osm)) 118 return false; 119 return true; 99 if (this == obj) return true; 100 if (obj == null || getClass() != obj.getClass()) return false; 101 if (!super.equals(obj)) return false; 102 ChangeCommand that = (ChangeCommand) obj; 103 return Objects.equals(osm, that.osm) && 104 Objects.equals(newOsm, that.newOsm); 120 105 } 121 106 } -
trunk/src/org/openstreetmap/josm/command/ChangeNodesCommand.java
r8456 r9371 6 6 import java.util.Collection; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 64 65 @Override 65 66 public int hashCode() { 66 final int prime = 31; 67 int result = super.hashCode(); 68 result = prime * result + ((newNodes == null) ? 0 : newNodes.hashCode()); 69 result = prime * result + ((way == null) ? 0 : way.hashCode()); 70 return result; 67 return Objects.hash(super.hashCode(), way, newNodes); 71 68 } 72 69 73 70 @Override 74 71 public boolean equals(Object obj) { 75 if (this == obj) 76 return true; 77 if (!super.equals(obj)) 78 return false; 79 if (getClass() != obj.getClass()) 80 return false; 81 ChangeNodesCommand other = (ChangeNodesCommand) obj; 82 if (newNodes == null) { 83 if (other.newNodes != null) 84 return false; 85 } else if (!newNodes.equals(other.newNodes)) 86 return false; 87 if (way == null) { 88 if (other.way != null) 89 return false; 90 } else if (!way.equals(other.way)) 91 return false; 92 return true; 72 if (this == obj) return true; 73 if (obj == null || getClass() != obj.getClass()) return false; 74 if (!super.equals(obj)) return false; 75 ChangeNodesCommand that = (ChangeNodesCommand) obj; 76 return Objects.equals(way, that.way) && 77 Objects.equals(newNodes, that.newNodes); 93 78 } 94 79 } -
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r8975 r9371 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Objects; 16 17 17 18 import javax.swing.Icon; … … 249 250 @Override 250 251 public int hashCode() { 251 final int prime = 31; 252 int result = super.hashCode(); 253 result = prime * result + ((objects == null) ? 0 : objects.hashCode()); 254 result = prime * result + ((tags == null) ? 0 : tags.hashCode()); 255 return result; 252 return Objects.hash(super.hashCode(), objects, tags); 256 253 } 257 254 258 255 @Override 259 256 public boolean equals(Object obj) { 260 if (this == obj) 261 return true; 262 if (!super.equals(obj)) 263 return false; 264 if (getClass() != obj.getClass()) 265 return false; 266 ChangePropertyCommand other = (ChangePropertyCommand) obj; 267 if (objects == null) { 268 if (other.objects != null) 269 return false; 270 } else if (!objects.equals(other.objects)) 271 return false; 272 if (tags == null) { 273 if (other.tags != null) 274 return false; 275 } else if (!tags.equals(other.tags)) 276 return false; 277 return true; 257 if (this == obj) return true; 258 if (obj == null || getClass() != obj.getClass()) return false; 259 if (!super.equals(obj)) return false; 260 ChangePropertyCommand that = (ChangePropertyCommand) obj; 261 return Objects.equals(objects, that.objects) && 262 Objects.equals(tags, that.tags); 278 263 } 279 264 } -
trunk/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java
r8846 r9371 10 10 import java.util.LinkedList; 11 11 import java.util.List; 12 import java.util.Objects; 12 13 13 14 import javax.swing.Icon; … … 129 130 @Override 130 131 public int hashCode() { 131 final int prime = 31; 132 int result = super.hashCode(); 133 result = prime * result + ((key == null) ? 0 : key.hashCode()); 134 result = prime * result + ((newKey == null) ? 0 : newKey.hashCode()); 135 result = prime * result + ((objects == null) ? 0 : objects.hashCode()); 136 return result; 132 return Objects.hash(super.hashCode(), objects, key, newKey); 137 133 } 138 134 139 135 @Override 140 136 public boolean equals(Object obj) { 141 if (this == obj) 142 return true; 143 if (!super.equals(obj)) 144 return false; 145 if (getClass() != obj.getClass()) 146 return false; 147 ChangePropertyKeyCommand other = (ChangePropertyKeyCommand) obj; 148 if (key == null) { 149 if (other.key != null) 150 return false; 151 } else if (!key.equals(other.key)) 152 return false; 153 if (newKey == null) { 154 if (other.newKey != null) 155 return false; 156 } else if (!newKey.equals(other.newKey)) 157 return false; 158 if (objects == null) { 159 if (other.objects != null) 160 return false; 161 } else if (!objects.equals(other.objects)) 162 return false; 163 return true; 137 if (this == obj) return true; 138 if (obj == null || getClass() != obj.getClass()) return false; 139 if (!super.equals(obj)) return false; 140 ChangePropertyKeyCommand that = (ChangePropertyKeyCommand) obj; 141 return Objects.equals(objects, that.objects) && 142 Objects.equals(key, that.key) && 143 Objects.equals(newKey, that.newKey); 164 144 } 165 145 } -
trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java
r9067 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import javax.swing.Icon; … … 84 85 @Override 85 86 public int hashCode() { 86 final int prime = 31; 87 int result = super.hashCode(); 88 result = prime * result + ((newRole == null) ? 0 : newRole.hashCode()); 89 result = prime * result + ((oldModified == null) ? 0 : oldModified.hashCode()); 90 result = prime * result + ((oldRole == null) ? 0 : oldRole.hashCode()); 91 result = prime * result + position; 92 result = prime * result + ((relation == null) ? 0 : relation.hashCode()); 93 return result; 87 return Objects.hash(super.hashCode(), relation, position, newRole, oldRole, oldModified); 94 88 } 95 89 96 90 @Override 97 91 public boolean equals(Object obj) { 98 if (this == obj) 99 return true; 100 if (!super.equals(obj)) 101 return false; 102 if (getClass() != obj.getClass()) 103 return false; 104 ChangeRelationMemberRoleCommand other = (ChangeRelationMemberRoleCommand) obj; 105 if (newRole == null) { 106 if (other.newRole != null) 107 return false; 108 } else if (!newRole.equals(other.newRole)) 109 return false; 110 if (oldModified == null) { 111 if (other.oldModified != null) 112 return false; 113 } else if (!oldModified.equals(other.oldModified)) 114 return false; 115 if (oldRole == null) { 116 if (other.oldRole != null) 117 return false; 118 } else if (!oldRole.equals(other.oldRole)) 119 return false; 120 if (position != other.position) 121 return false; 122 if (relation == null) { 123 if (other.relation != null) 124 return false; 125 } else if (!relation.equals(other.relation)) 126 return false; 127 return true; 92 if (this == obj) return true; 93 if (obj == null || getClass() != obj.getClass()) return false; 94 if (!super.equals(obj)) return false; 95 ChangeRelationMemberRoleCommand that = (ChangeRelationMemberRoleCommand) obj; 96 return position == that.position && 97 Objects.equals(relation, that.relation) && 98 Objects.equals(newRole, that.newRole) && 99 Objects.equals(oldRole, that.oldRole) && 100 Objects.equals(oldModified, that.oldModified); 128 101 } 129 102 } -
trunk/src/org/openstreetmap/josm/command/Command.java
r8945 r9371 9 9 import java.util.Map; 10 10 import java.util.Map.Entry; 11 import java.util.Objects; 11 12 12 13 import javax.swing.JOptionPane; … … 105 106 @Override 106 107 public int hashCode() { 107 final int prime = 31; 108 int result = 1; 109 result = prime * result + ((eastNorth == null) ? 0 : eastNorth.hashCode()); 110 result = prime * result + ((latlon == null) ? 0 : latlon.hashCode()); 111 result = prime * result + (modified ? 1231 : 1237); 112 return result; 108 return Objects.hash(latlon, eastNorth, modified); 113 109 } 114 110 115 111 @Override 116 112 public boolean equals(Object obj) { 117 if (this == obj) 118 return true; 119 if (obj == null) 120 return false; 121 if (getClass() != obj.getClass()) 122 return false; 123 OldNodeState other = (OldNodeState) obj; 124 if (eastNorth == null) { 125 if (other.eastNorth != null) 126 return false; 127 } else if (!eastNorth.equals(other.eastNorth)) 128 return false; 129 if (latlon == null) { 130 if (other.latlon != null) 131 return false; 132 } else if (!latlon.equals(other.latlon)) 133 return false; 134 if (modified != other.modified) 135 return false; 136 return true; 113 if (this == obj) return true; 114 if (obj == null || getClass() != obj.getClass()) return false; 115 OldNodeState that = (OldNodeState) obj; 116 return modified == that.modified && 117 Objects.equals(latlon, that.latlon) && 118 Objects.equals(eastNorth, that.eastNorth); 137 119 } 138 120 } … … 306 288 @Override 307 289 public int hashCode() { 308 final int prime = 31; 309 int result = 1; 310 result = prime * result + ((cloneMap == null) ? 0 : cloneMap.hashCode()); 311 result = prime * result + ((layer == null) ? 0 : layer.hashCode()); 312 return result; 290 return Objects.hash(cloneMap, layer); 313 291 } 314 292 315 293 @Override 316 294 public boolean equals(Object obj) { 317 if (this == obj) 318 return true; 319 if (obj == null) 320 return false; 321 if (getClass() != obj.getClass()) 322 return false; 323 Command other = (Command) obj; 324 if (cloneMap == null) { 325 if (other.cloneMap != null) 326 return false; 327 } else if (!cloneMap.equals(other.cloneMap)) 328 return false; 329 if (layer == null) { 330 if (other.layer != null) 331 return false; 332 } else if (!layer.equals(other.layer)) 333 return false; 334 return true; 295 if (this == obj) return true; 296 if (obj == null || getClass() != obj.getClass()) return false; 297 Command command = (Command) obj; 298 return Objects.equals(cloneMap, command.cloneMap) && 299 Objects.equals(layer, command.layer); 335 300 } 336 301 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r9072 r9371 18 18 import java.util.Map; 19 19 import java.util.Map.Entry; 20 import java.util.Objects; 20 21 import java.util.Set; 21 22 … … 518 519 @Override 519 520 public int hashCode() { 520 final int prime = 31; 521 int result = super.hashCode(); 522 result = prime * result + ((clonedPrimitives == null) ? 0 : clonedPrimitives.hashCode()); 523 result = prime * result + ((toDelete == null) ? 0 : toDelete.hashCode()); 524 return result; 521 return Objects.hash(super.hashCode(), toDelete, clonedPrimitives); 525 522 } 526 523 527 524 @Override 528 525 public boolean equals(Object obj) { 529 if (this == obj) 530 return true; 531 if (!super.equals(obj)) 532 return false; 533 if (getClass() != obj.getClass()) 534 return false; 535 DeleteCommand other = (DeleteCommand) obj; 536 if (clonedPrimitives == null) { 537 if (other.clonedPrimitives != null) 538 return false; 539 } else if (!clonedPrimitives.equals(other.clonedPrimitives)) 540 return false; 541 if (toDelete == null) { 542 if (other.toDelete != null) 543 return false; 544 } else if (!toDelete.equals(other.toDelete)) 545 return false; 546 return true; 526 if (this == obj) return true; 527 if (obj == null || getClass() != obj.getClass()) return false; 528 if (!super.equals(obj)) return false; 529 DeleteCommand that = (DeleteCommand) obj; 530 return Objects.equals(toDelete, that.toDelete) && 531 Objects.equals(clonedPrimitives, that.clonedPrimitives); 547 532 } 548 533 } -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r9231 r9371 9 9 import java.util.LinkedList; 10 10 import java.util.List; 11 import java.util.Objects; 11 12 12 13 import javax.swing.Icon; … … 246 247 @Override 247 248 public int hashCode() { 248 final int prime = 31; 249 int result = super.hashCode(); 250 long temp; 251 temp = Double.doubleToLongBits(backupX); 252 result = prime * result + (int) (temp ^ (temp >>> 32)); 253 temp = Double.doubleToLongBits(backupY); 254 result = prime * result + (int) (temp ^ (temp >>> 32)); 255 result = prime * result + ((nodes == null) ? 0 : nodes.hashCode()); 256 result = prime * result + ((oldState == null) ? 0 : oldState.hashCode()); 257 result = prime * result + ((startEN == null) ? 0 : startEN.hashCode()); 258 temp = Double.doubleToLongBits(x); 259 result = prime * result + (int) (temp ^ (temp >>> 32)); 260 temp = Double.doubleToLongBits(y); 261 result = prime * result + (int) (temp ^ (temp >>> 32)); 262 return result; 249 return Objects.hash(super.hashCode(), nodes, startEN, x, y, backupX, backupY, oldState); 263 250 } 264 251 265 252 @Override 266 253 public boolean equals(Object obj) { 267 if (this == obj) 268 return true; 269 if (!super.equals(obj)) 270 return false; 271 if (getClass() != obj.getClass()) 272 return false; 273 MoveCommand other = (MoveCommand) obj; 274 if (Double.doubleToLongBits(backupX) != Double.doubleToLongBits(other.backupX)) 275 return false; 276 if (Double.doubleToLongBits(backupY) != Double.doubleToLongBits(other.backupY)) 277 return false; 278 if (nodes == null) { 279 if (other.nodes != null) 280 return false; 281 } else if (!nodes.equals(other.nodes)) 282 return false; 283 if (oldState == null) { 284 if (other.oldState != null) 285 return false; 286 } else if (!oldState.equals(other.oldState)) 287 return false; 288 if (startEN == null) { 289 if (other.startEN != null) 290 return false; 291 } else if (!startEN.equals(other.startEN)) 292 return false; 293 if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) 294 return false; 295 if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y)) 296 return false; 297 return true; 254 if (this == obj) return true; 255 if (obj == null || getClass() != obj.getClass()) return false; 256 if (!super.equals(obj)) return false; 257 MoveCommand that = (MoveCommand) obj; 258 return Double.compare(that.x, x) == 0 && 259 Double.compare(that.y, y) == 0 && 260 Double.compare(that.backupX, backupX) == 0 && 261 Double.compare(that.backupY, backupY) == 0 && 262 Objects.equals(nodes, that.nodes) && 263 Objects.equals(startEN, that.startEN) && 264 Objects.equals(oldState, that.oldState); 298 265 } 299 266 } -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r9243 r9371 11 11 import java.util.List; 12 12 import java.util.Map; 13 import java.util.Objects; 13 14 import java.util.Set; 14 15 … … 279 280 @Override 280 281 public int hashCode() { 281 final int prime = 31; 282 int result = super.hashCode(); 283 result = prime * result + ((ds == null) ? 0 : ds.hashCode()); 284 result = prime * result + ((makeIncompleteData == null) ? 0 : makeIncompleteData.hashCode()); 285 result = prime * result + ((makeIncompleteDataByPrimId == null) ? 0 : makeIncompleteDataByPrimId.hashCode()); 286 result = prime * result + ((purgedConflicts == null) ? 0 : purgedConflicts.hashCode()); 287 result = prime * result + ((toPurge == null) ? 0 : toPurge.hashCode()); 288 return result; 282 return Objects.hash(super.hashCode(), toPurge, makeIncompleteData, makeIncompleteDataByPrimId, purgedConflicts, ds); 289 283 } 290 284 291 285 @Override 292 286 public boolean equals(Object obj) { 293 if (this == obj) 294 return true; 295 if (!super.equals(obj)) 296 return false; 297 if (getClass() != obj.getClass()) 298 return false; 299 PurgeCommand other = (PurgeCommand) obj; 300 if (ds == null) { 301 if (other.ds != null) 302 return false; 303 } else if (!ds.equals(other.ds)) 304 return false; 305 if (makeIncompleteData == null) { 306 if (other.makeIncompleteData != null) 307 return false; 308 } else if (!makeIncompleteData.equals(other.makeIncompleteData)) 309 return false; 310 if (makeIncompleteDataByPrimId == null) { 311 if (other.makeIncompleteDataByPrimId != null) 312 return false; 313 } else if (!makeIncompleteDataByPrimId.equals(other.makeIncompleteDataByPrimId)) 314 return false; 315 if (purgedConflicts == null) { 316 if (other.purgedConflicts != null) 317 return false; 318 } else if (!purgedConflicts.equals(other.purgedConflicts)) 319 return false; 320 if (toPurge == null) { 321 if (other.toPurge != null) 322 return false; 323 } else if (!toPurge.equals(other.toPurge)) 324 return false; 325 return true; 287 if (this == obj) return true; 288 if (obj == null || getClass() != obj.getClass()) return false; 289 if (!super.equals(obj)) return false; 290 PurgeCommand that = (PurgeCommand) obj; 291 return Objects.equals(toPurge, that.toPurge) && 292 Objects.equals(makeIncompleteData, that.makeIncompleteData) && 293 Objects.equals(makeIncompleteDataByPrimId, that.makeIncompleteDataByPrimId) && 294 Objects.equals(purgedConflicts, that.purgedConflicts) && 295 Objects.equals(ds, that.ds); 326 296 } 327 297 } -
trunk/src/org/openstreetmap/josm/command/RemoveNodesCommand.java
r8456 r9371 7 7 import java.util.HashSet; 8 8 import java.util.List; 9 import java.util.Objects; 9 10 import java.util.Set; 10 11 … … 65 66 @Override 66 67 public int hashCode() { 67 final int prime = 31; 68 int result = super.hashCode(); 69 result = prime * result + ((rmNodes == null) ? 0 : rmNodes.hashCode()); 70 result = prime * result + ((way == null) ? 0 : way.hashCode()); 71 return result; 68 return Objects.hash(super.hashCode(), way, rmNodes); 72 69 } 73 70 74 71 @Override 75 72 public boolean equals(Object obj) { 76 if (this == obj) 77 return true; 78 if (!super.equals(obj)) 79 return false; 80 if (getClass() != obj.getClass()) 81 return false; 82 RemoveNodesCommand other = (RemoveNodesCommand) obj; 83 if (rmNodes == null) { 84 if (other.rmNodes != null) 85 return false; 86 } else if (!rmNodes.equals(other.rmNodes)) 87 return false; 88 if (way == null) { 89 if (other.way != null) 90 return false; 91 } else if (!way.equals(other.way)) 92 return false; 93 return true; 73 if (this == obj) return true; 74 if (obj == null || getClass() != obj.getClass()) return false; 75 if (!super.equals(obj)) return false; 76 RemoveNodesCommand that = (RemoveNodesCommand) obj; 77 return Objects.equals(way, that.way) && 78 Objects.equals(rmNodes, that.rmNodes); 94 79 } 95 80 } -
trunk/src/org/openstreetmap/josm/command/RotateCommand.java
r9243 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.data.coor.EastNorth; … … 93 94 @Override 94 95 public int hashCode() { 95 final int prime = 31; 96 int result = super.hashCode(); 97 result = prime * result + ((pivot == null) ? 0 : pivot.hashCode()); 98 long temp; 99 temp = Double.doubleToLongBits(rotationAngle); 100 result = prime * result + (int) (temp ^ (temp >>> 32)); 101 temp = Double.doubleToLongBits(startAngle); 102 result = prime * result + (int) (temp ^ (temp >>> 32)); 103 return result; 96 return Objects.hash(super.hashCode(), pivot, startAngle, rotationAngle); 104 97 } 105 98 106 99 @Override 107 100 public boolean equals(Object obj) { 108 if (this == obj) 109 return true; 110 if (!super.equals(obj)) 111 return false; 112 if (getClass() != obj.getClass()) 113 return false; 114 RotateCommand other = (RotateCommand) obj; 115 if (pivot == null) { 116 if (other.pivot != null) 117 return false; 118 } else if (!pivot.equals(other.pivot)) 119 return false; 120 if (Double.doubleToLongBits(rotationAngle) != Double.doubleToLongBits(other.rotationAngle)) 121 return false; 122 if (Double.doubleToLongBits(startAngle) != Double.doubleToLongBits(other.startAngle)) 123 return false; 124 return true; 101 if (this == obj) return true; 102 if (obj == null || getClass() != obj.getClass()) return false; 103 if (!super.equals(obj)) return false; 104 RotateCommand that = (RotateCommand) obj; 105 return Double.compare(that.startAngle, startAngle) == 0 && 106 Double.compare(that.rotationAngle, rotationAngle) == 0 && 107 Objects.equals(pivot, that.pivot); 125 108 } 126 109 } -
trunk/src/org/openstreetmap/josm/command/ScaleCommand.java
r9243 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.data.coor.EastNorth; … … 83 84 @Override 84 85 public int hashCode() { 85 final int prime = 31; 86 int result = super.hashCode(); 87 result = prime * result + ((pivot == null) ? 0 : pivot.hashCode()); 88 long temp; 89 temp = Double.doubleToLongBits(scalingFactor); 90 result = prime * result + (int) (temp ^ (temp >>> 32)); 91 result = prime * result + ((startEN == null) ? 0 : startEN.hashCode()); 92 return result; 86 return Objects.hash(super.hashCode(), pivot, scalingFactor, startEN); 93 87 } 94 88 95 89 @Override 96 90 public boolean equals(Object obj) { 97 if (this == obj) 98 return true; 99 if (!super.equals(obj)) 100 return false; 101 if (getClass() != obj.getClass()) 102 return false; 103 ScaleCommand other = (ScaleCommand) obj; 104 if (pivot == null) { 105 if (other.pivot != null) 106 return false; 107 } else if (!pivot.equals(other.pivot)) 108 return false; 109 if (Double.doubleToLongBits(scalingFactor) != Double.doubleToLongBits(other.scalingFactor)) 110 return false; 111 if (startEN == null) { 112 if (other.startEN != null) 113 return false; 114 } else if (!startEN.equals(other.startEN)) 115 return false; 116 return true; 91 if (this == obj) return true; 92 if (obj == null || getClass() != obj.getClass()) return false; 93 if (!super.equals(obj)) return false; 94 ScaleCommand that = (ScaleCommand) obj; 95 return Double.compare(that.scalingFactor, scalingFactor) == 0 && 96 Objects.equals(pivot, that.pivot) && 97 Objects.equals(startEN, that.startEN); 117 98 } 118 99 } -
trunk/src/org/openstreetmap/josm/command/SelectCommand.java
r8456 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.Main; … … 54 55 @Override 55 56 public int hashCode() { 56 final int prime = 31; 57 int result = super.hashCode(); 58 result = prime * result + ((newSelection == null) ? 0 : newSelection.hashCode()); 59 result = prime * result + ((oldSelection == null) ? 0 : oldSelection.hashCode()); 60 return result; 57 return Objects.hash(super.hashCode(), newSelection, oldSelection); 61 58 } 62 59 63 60 @Override 64 61 public boolean equals(Object obj) { 65 if (this == obj) 66 return true; 67 if (!super.equals(obj)) 68 return false; 69 if (getClass() != obj.getClass()) 70 return false; 71 SelectCommand other = (SelectCommand) obj; 72 if (newSelection == null) { 73 if (other.newSelection != null) 74 return false; 75 } else if (!newSelection.equals(other.newSelection)) 76 return false; 77 if (oldSelection == null) { 78 if (other.oldSelection != null) 79 return false; 80 } else if (!oldSelection.equals(other.oldSelection)) 81 return false; 82 return true; 62 if (this == obj) return true; 63 if (obj == null || getClass() != obj.getClass()) return false; 64 if (!super.equals(obj)) return false; 65 SelectCommand that = (SelectCommand) obj; 66 return Objects.equals(newSelection, that.newSelection) && 67 Objects.equals(oldSelection, that.oldSelection); 83 68 } 84 69 } -
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r8840 r9371 7 7 import java.util.Collection; 8 8 import java.util.HashSet; 9 import java.util.Objects; 9 10 10 11 import javax.swing.Icon; … … 126 127 @Override 127 128 public int hashCode() { 128 final int prime = 31; 129 int result = super.hashCode(); 130 result = prime * result + (continueOnError ? 1231 : 1237); 131 result = prime * result + ((name == null) ? 0 : name.hashCode()); 132 result = prime * result + Arrays.hashCode(sequence); 133 result = prime * result + (sequenceComplete ? 1231 : 1237); 134 return result; 129 return Objects.hash(super.hashCode(), sequence, sequenceComplete, name, continueOnError); 135 130 } 136 131 137 132 @Override 138 133 public boolean equals(Object obj) { 139 if (this == obj) 140 return true; 141 if (!super.equals(obj)) 142 return false; 143 if (getClass() != obj.getClass()) 144 return false; 145 SequenceCommand other = (SequenceCommand) obj; 146 if (continueOnError != other.continueOnError) 147 return false; 148 if (name == null) { 149 if (other.name != null) 150 return false; 151 } else if (!name.equals(other.name)) 152 return false; 153 if (!Arrays.equals(sequence, other.sequence)) 154 return false; 155 if (sequenceComplete != other.sequenceComplete) 156 return false; 157 return true; 134 if (this == obj) return true; 135 if (obj == null || getClass() != obj.getClass()) return false; 136 if (!super.equals(obj)) return false; 137 SequenceCommand that = (SequenceCommand) obj; 138 return sequenceComplete == that.sequenceComplete && 139 continueOnError == that.continueOnError && 140 Arrays.equals(sequence, that.sequence) && 141 Objects.equals(name, that.name); 158 142 } 159 143 } -
trunk/src/org/openstreetmap/josm/command/TransformNodesCommand.java
r9243 r9371 8 8 import java.util.LinkedList; 9 9 import java.util.Map; 10 import java.util.Objects; 10 11 11 12 import javax.swing.Icon; … … 145 146 @Override 146 147 public int hashCode() { 147 final int prime = 31; 148 int result = super.hashCode(); 149 result = prime * result + ((nodes == null) ? 0 : nodes.hashCode()); 150 result = prime * result + ((oldStates == null) ? 0 : oldStates.hashCode()); 151 return result; 148 return Objects.hash(super.hashCode(), nodes, oldStates); 152 149 } 153 150 154 151 @Override 155 152 public boolean equals(Object obj) { 156 if (this == obj) 157 return true; 158 if (!super.equals(obj)) 159 return false; 160 if (getClass() != obj.getClass()) 161 return false; 162 TransformNodesCommand other = (TransformNodesCommand) obj; 163 if (nodes == null) { 164 if (other.nodes != null) 165 return false; 166 } else if (!nodes.equals(other.nodes)) 167 return false; 168 if (oldStates == null) { 169 if (other.oldStates != null) 170 return false; 171 } else if (!oldStates.equals(other.oldStates)) 172 return false; 173 return true; 153 if (this == obj) return true; 154 if (obj == null || getClass() != obj.getClass()) return false; 155 if (!super.equals(obj)) return false; 156 TransformNodesCommand that = (TransformNodesCommand) obj; 157 return Objects.equals(nodes, that.nodes) && 158 Objects.equals(oldStates, that.oldStates); 174 159 } 175 160 } -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r8914 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import javax.swing.Icon; … … 89 90 @Override 90 91 public int hashCode() { 91 final int prime = 31; 92 int result = super.hashCode(); 93 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 94 return result; 92 return Objects.hash(super.hashCode(), conflict); 95 93 } 96 94 97 95 @Override 98 96 public boolean equals(Object obj) { 99 if (this == obj) 100 return true; 101 if (!super.equals(obj)) 102 return false; 103 if (getClass() != obj.getClass()) 104 return false; 105 ConflictAddCommand other = (ConflictAddCommand) obj; 106 if (conflict == null) { 107 if (other.conflict != null) 108 return false; 109 } else if (!conflict.equals(other.conflict)) 110 return false; 111 return true; 97 if (this == obj) return true; 98 if (obj == null || getClass() != obj.getClass()) return false; 99 if (!super.equals(obj)) return false; 100 ConflictAddCommand that = (ConflictAddCommand) obj; 101 return Objects.equals(conflict, that.conflict); 112 102 } 113 103 } -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
r8914 r9371 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.util.Objects; 5 7 6 8 import org.openstreetmap.josm.Main; … … 84 86 @Override 85 87 public int hashCode() { 86 final int prime = 31; 87 int result = super.hashCode(); 88 result = prime * result + ((resolvedConflicts == null) ? 0 : resolvedConflicts.hashCode()); 89 return result; 88 return Objects.hash(super.hashCode(), resolvedConflicts); 90 89 } 91 90 92 91 @Override 93 92 public boolean equals(Object obj) { 94 if (this == obj) 95 return true; 96 if (!super.equals(obj)) 97 return false; 98 if (getClass() != obj.getClass()) 99 return false; 100 ConflictResolveCommand other = (ConflictResolveCommand) obj; 101 if (resolvedConflicts == null) { 102 if (other.resolvedConflicts != null) 103 return false; 104 } else if (!resolvedConflicts.equals(other.resolvedConflicts)) 105 return false; 106 return true; 93 if (this == obj) return true; 94 if (obj == null || getClass() != obj.getClass()) return false; 95 if (!super.equals(obj)) return false; 96 ConflictResolveCommand that = (ConflictResolveCommand) obj; 97 return Objects.equals(resolvedConflicts, that.resolvedConflicts); 107 98 } 108 99 } -
trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java
r8910 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 8 9 import javax.swing.Icon; … … 76 77 @Override 77 78 public int hashCode() { 78 final int prime = 31; 79 int result = super.hashCode(); 80 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 81 result = prime * result + ((decision == null) ? 0 : decision.hashCode()); 82 return result; 79 return Objects.hash(super.hashCode(), conflict, decision); 83 80 } 84 81 85 82 @Override 86 83 public boolean equals(Object obj) { 87 if (this == obj) 88 return true; 89 if (!super.equals(obj)) 90 return false; 91 if (getClass() != obj.getClass()) 92 return false; 93 CoordinateConflictResolveCommand other = (CoordinateConflictResolveCommand) obj; 94 if (conflict == null) { 95 if (other.conflict != null) 96 return false; 97 } else if (!conflict.equals(other.conflict)) 98 return false; 99 if (decision != other.decision) 100 return false; 101 return true; 84 if (this == obj) return true; 85 if (obj == null || getClass() != obj.getClass()) return false; 86 if (!super.equals(obj)) return false; 87 CoordinateConflictResolveCommand that = (CoordinateConflictResolveCommand) obj; 88 return Objects.equals(conflict, that.conflict) && 89 decision == that.decision; 102 90 } 103 91 } -
trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java
r8910 r9371 5 5 6 6 import java.util.Collection; 7 import java.util.Objects; 7 8 import java.util.Set; 8 9 … … 91 92 @Override 92 93 public int hashCode() { 93 final int prime = 31; 94 int result = super.hashCode(); 95 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 96 result = prime * result + ((decision == null) ? 0 : decision.hashCode()); 97 return result; 94 return Objects.hash(super.hashCode(), conflict, decision); 98 95 } 99 96 100 97 @Override 101 98 public boolean equals(Object obj) { 102 if (this == obj) 103 return true; 104 if (!super.equals(obj)) 105 return false; 106 if (getClass() != obj.getClass()) 107 return false; 108 DeletedStateConflictResolveCommand other = (DeletedStateConflictResolveCommand) obj; 109 if (conflict == null) { 110 if (other.conflict != null) 111 return false; 112 } else if (!conflict.equals(other.conflict)) 113 return false; 114 if (decision != other.decision) 115 return false; 116 return true; 99 if (this == obj) return true; 100 if (obj == null || getClass() != obj.getClass()) return false; 101 if (!super.equals(obj)) return false; 102 DeletedStateConflictResolveCommand that = (DeletedStateConflictResolveCommand) obj; 103 return Objects.equals(conflict, that.conflict) && 104 decision == that.decision; 117 105 } 118 106 } -
trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java
r8910 r9371 6 6 7 7 import java.util.Collection; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 67 68 @Override 68 69 public int hashCode() { 69 final int prime = 31; 70 int result = super.hashCode(); 71 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 72 return result; 70 return Objects.hash(super.hashCode(), conflict); 73 71 } 74 72 75 73 @Override 76 74 public boolean equals(Object obj) { 77 if (this == obj) 78 return true; 79 if (!super.equals(obj)) 80 return false; 81 if (getClass() != obj.getClass()) 82 return false; 83 ModifiedConflictResolveCommand other = (ModifiedConflictResolveCommand) obj; 84 if (conflict == null) { 85 if (other.conflict != null) 86 return false; 87 } else if (!conflict.equals(other.conflict)) 88 return false; 89 return true; 75 if (this == obj) return true; 76 if (obj == null || getClass() != obj.getClass()) return false; 77 if (!super.equals(obj)) return false; 78 ModifiedConflictResolveCommand that = (ModifiedConflictResolveCommand) obj; 79 return Objects.equals(conflict, that.conflict); 90 80 } 91 81 } -
trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
r8510 r9371 6 6 import java.util.Collection; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 98 99 @Override 99 100 public int hashCode() { 100 final int prime = 31; 101 int result = super.hashCode(); 102 result = prime * result + ((mergedMembers == null) ? 0 : mergedMembers.hashCode()); 103 result = prime * result + ((my == null) ? 0 : my.hashCode()); 104 result = prime * result + ((their == null) ? 0 : their.hashCode()); 105 return result; 101 return Objects.hash(super.hashCode(), my, their, mergedMembers); 106 102 } 107 103 108 104 @Override 109 105 public boolean equals(Object obj) { 110 if (this == obj) 111 return true; 112 if (!super.equals(obj)) 113 return false; 114 if (getClass() != obj.getClass()) 115 return false; 116 RelationMemberConflictResolverCommand other = (RelationMemberConflictResolverCommand) obj; 117 if (mergedMembers == null) { 118 if (other.mergedMembers != null) 119 return false; 120 } else if (!mergedMembers.equals(other.mergedMembers)) 121 return false; 122 if (my == null) { 123 if (other.my != null) 124 return false; 125 } else if (!my.equals(other.my)) 126 return false; 127 if (their == null) { 128 if (other.their != null) 129 return false; 130 } else if (!their.equals(other.their)) 131 return false; 132 return true; 106 if (this == obj) return true; 107 if (obj == null || getClass() != obj.getClass()) return false; 108 if (!super.equals(obj)) return false; 109 RelationMemberConflictResolverCommand that = (RelationMemberConflictResolverCommand) obj; 110 return Objects.equals(my, that.my) && 111 Objects.equals(their, that.their) && 112 Objects.equals(mergedMembers, that.mergedMembers); 133 113 } 134 114 } -
trunk/src/org/openstreetmap/josm/command/conflict/TagConflictResolveCommand.java
r8910 r9371 6 6 import java.util.Collection; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 103 104 @Override 104 105 public int hashCode() { 105 final int prime = 31; 106 int result = super.hashCode(); 107 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 108 result = prime * result + ((mergeItems == null) ? 0 : mergeItems.hashCode()); 109 return result; 106 return Objects.hash(super.hashCode(), conflict, mergeItems); 110 107 } 111 108 112 109 @Override 113 110 public boolean equals(Object obj) { 114 if (this == obj) 115 return true; 116 if (!super.equals(obj)) 117 return false; 118 if (getClass() != obj.getClass()) 119 return false; 120 TagConflictResolveCommand other = (TagConflictResolveCommand) obj; 121 if (conflict == null) { 122 if (other.conflict != null) 123 return false; 124 } else if (!conflict.equals(other.conflict)) 125 return false; 126 if (mergeItems == null) { 127 if (other.mergeItems != null) 128 return false; 129 } else if (!mergeItems.equals(other.mergeItems)) 130 return false; 131 return true; 111 if (this == obj) return true; 112 if (obj == null || getClass() != obj.getClass()) return false; 113 if (!super.equals(obj)) return false; 114 TagConflictResolveCommand that = (TagConflictResolveCommand) obj; 115 return Objects.equals(conflict, that.conflict) && 116 Objects.equals(mergeItems, that.mergeItems); 132 117 } 133 118 } -
trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java
r8910 r9371 6 6 7 7 import java.util.Collection; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 76 77 @Override 77 78 public int hashCode() { 78 final int prime = 31; 79 int result = super.hashCode(); 80 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 81 return result; 79 return Objects.hash(super.hashCode(), conflict); 82 80 } 83 81 84 82 @Override 85 83 public boolean equals(Object obj) { 86 if (this == obj) 87 return true; 88 if (!super.equals(obj)) 89 return false; 90 if (getClass() != obj.getClass()) 91 return false; 92 VersionConflictResolveCommand other = (VersionConflictResolveCommand) obj; 93 if (conflict == null) { 94 if (other.conflict != null) 95 return false; 96 } else if (!conflict.equals(other.conflict)) 97 return false; 98 return true; 84 if (this == obj) return true; 85 if (obj == null || getClass() != obj.getClass()) return false; 86 if (!super.equals(obj)) return false; 87 VersionConflictResolveCommand that = (VersionConflictResolveCommand) obj; 88 return Objects.equals(conflict, that.conflict); 99 89 } 100 90 } -
trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java
r8910 r9371 6 6 import java.util.Collection; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import javax.swing.Icon; … … 75 76 @Override 76 77 public int hashCode() { 77 final int prime = 31; 78 int result = super.hashCode(); 79 result = prime * result + ((conflict == null) ? 0 : conflict.hashCode()); 80 result = prime * result + ((mergedNodeList == null) ? 0 : mergedNodeList.hashCode()); 81 return result; 78 return Objects.hash(super.hashCode(), conflict, mergedNodeList); 82 79 } 83 80 84 81 @Override 85 82 public boolean equals(Object obj) { 86 if (this == obj) 87 return true; 88 if (!super.equals(obj)) 89 return false; 90 if (getClass() != obj.getClass()) 91 return false; 92 WayNodesConflictResolverCommand other = (WayNodesConflictResolverCommand) obj; 93 if (conflict == null) { 94 if (other.conflict != null) 95 return false; 96 } else if (!conflict.equals(other.conflict)) 97 return false; 98 if (mergedNodeList == null) { 99 if (other.mergedNodeList != null) 100 return false; 101 } else if (!mergedNodeList.equals(other.mergedNodeList)) 102 return false; 103 return true; 83 if (this == obj) return true; 84 if (obj == null || getClass() != obj.getClass()) return false; 85 if (!super.equals(obj)) return false; 86 WayNodesConflictResolverCommand that = (WayNodesConflictResolverCommand) obj; 87 return Objects.equals(conflict, that.conflict) && 88 Objects.equals(mergedNodeList, that.mergedNodeList); 104 89 } 105 90 } -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r9243 r9371 7 7 import java.text.DecimalFormat; 8 8 import java.text.MessageFormat; 9 import java.util.Objects; 9 10 10 11 import org.openstreetmap.josm.data.coor.LatLon; … … 443 444 @Override 444 445 public int hashCode() { 445 final int prime = 31; 446 int result = 1; 447 long temp; 448 temp = Double.doubleToLongBits(maxLat); 449 result = prime * result + (int) (temp ^ (temp >>> 32)); 450 temp = Double.doubleToLongBits(maxLon); 451 result = prime * result + (int) (temp ^ (temp >>> 32)); 452 temp = Double.doubleToLongBits(minLat); 453 result = prime * result + (int) (temp ^ (temp >>> 32)); 454 temp = Double.doubleToLongBits(minLon); 455 result = prime * result + (int) (temp ^ (temp >>> 32)); 456 return result; 446 return Objects.hash(minLat, minLon, maxLat, maxLon); 457 447 } 458 448 459 449 @Override 460 450 public boolean equals(Object obj) { 461 if (this == obj) 462 return true; 463 if (obj == null) 464 return false; 465 if (getClass() != obj.getClass()) 466 return false; 467 Bounds other = (Bounds) obj; 468 if (Double.doubleToLongBits(maxLat) != Double.doubleToLongBits(other.maxLat)) 469 return false; 470 if (Double.doubleToLongBits(maxLon) != Double.doubleToLongBits(other.maxLon)) 471 return false; 472 if (Double.doubleToLongBits(minLat) != Double.doubleToLongBits(other.minLat)) 473 return false; 474 if (Double.doubleToLongBits(minLon) != Double.doubleToLongBits(other.minLon)) 475 return false; 476 return true; 451 if (this == obj) return true; 452 if (obj == null || getClass() != obj.getClass()) return false; 453 Bounds bounds = (Bounds) obj; 454 return Double.compare(bounds.minLat, minLat) == 0 && 455 Double.compare(bounds.minLon, minLon) == 0 && 456 Double.compare(bounds.maxLat, maxLat) == 0 && 457 Double.compare(bounds.maxLon, maxLon) == 0; 477 458 } 478 459 } -
trunk/src/org/openstreetmap/josm/data/DataSource.java
r8846 r9371 6 6 import java.util.Collection; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 40 41 @Override 41 42 public int hashCode() { 42 final int prime = 31; 43 int result = 1; 44 result = prime * result + ((bounds == null) ? 0 : bounds.hashCode()); 45 result = prime * result + ((origin == null) ? 0 : origin.hashCode()); 46 return result; 43 return Objects.hash(bounds, origin); 47 44 } 48 45 49 46 @Override 50 47 public boolean equals(Object obj) { 51 if (this == obj) 52 return true; 53 if (obj == null) 54 return false; 55 if (getClass() != obj.getClass()) 56 return false; 57 DataSource other = (DataSource) obj; 58 if (bounds == null) { 59 if (other.bounds != null) 60 return false; 61 } else if (!bounds.equals(other.bounds)) 62 return false; 63 if (origin == null) { 64 if (other.origin != null) 65 return false; 66 } else if (!origin.equals(other.origin)) 67 return false; 68 return true; 48 if (this == obj) return true; 49 if (obj == null || getClass() != obj.getClass()) return false; 50 DataSource that = (DataSource) obj; 51 return Objects.equals(bounds, that.bounds) && 52 Objects.equals(origin, that.origin); 69 53 } 70 54 -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r9312 r9371 228 228 @Override 229 229 public int hashCode() { 230 final int prime = 31; 231 int result = 1; 232 result = prime * result + ((value == null) ? 0 : value.hashCode()); 233 return result; 230 return Objects.hash(value); 234 231 } 235 232 236 233 @Override 237 234 public boolean equals(Object obj) { 238 if (this == obj) 239 return true; 240 if (obj == null) 241 return false; 242 if (!(obj instanceof AbstractSetting)) 243 return false; 244 AbstractSetting<?> other = (AbstractSetting<?>) obj; 245 if (value == null) { 246 if (other.value != null) 247 return false; 248 } else if (!value.equals(other.value)) 249 return false; 250 return true; 235 if (this == obj) return true; 236 if (obj == null || getClass() != obj.getClass()) return false; 237 AbstractSetting<?> that = (AbstractSetting<?>) obj; 238 return Objects.equals(value, that.value); 251 239 } 252 240 } -
trunk/src/org/openstreetmap/josm/data/conflict/Conflict.java
r9239 r9371 3 3 4 4 import java.util.Map; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 84 85 @Override 85 86 public int hashCode() { 86 final int prime = 31; 87 int result = 1; 88 result = prime * result + ((my == null) ? 0 : my.hashCode()); 89 result = prime * result + ((their == null) ? 0 : their.hashCode()); 90 return result; 87 return Objects.hash(my, their); 91 88 } 92 89 93 @SuppressWarnings("unchecked")94 90 @Override 95 91 public boolean equals(Object obj) { 96 if (this == obj) 97 return true; 98 if (obj == null) 99 return false; 100 if (getClass() != obj.getClass()) 101 return false; 102 Conflict<T> other = (Conflict<T>) obj; 103 if (my != other.my) 104 return false; 105 if (their != other.their) 106 return false; 107 return true; 92 if (this == obj) return true; 93 if (obj == null || getClass() != obj.getClass()) return false; 94 Conflict<?> conflict = (Conflict<?>) obj; 95 return Objects.equals(my, conflict.my) && 96 Objects.equals(their, conflict.their); 108 97 } 109 98 -
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r9067 r9371 9 9 import java.util.Iterator; 10 10 import java.util.List; 11 import java.util.Objects; 11 12 import java.util.Set; 12 13 import java.util.concurrent.CopyOnWriteArrayList; … … 386 387 @Override 387 388 public int hashCode() { 388 final int prime = 31; 389 int result = 1; 390 result = prime * result + ((conflicts == null) ? 0 : conflicts.hashCode()); 391 result = prime * result + ((listeners == null) ? 0 : listeners.hashCode()); 392 return result; 389 return Objects.hash(conflicts, listeners); 393 390 } 394 391 395 392 @Override 396 393 public boolean equals(Object obj) { 397 if (this == obj) 398 return true; 399 if (obj == null) 400 return false; 401 if (getClass() != obj.getClass()) 402 return false; 403 ConflictCollection other = (ConflictCollection) obj; 404 if (conflicts == null) { 405 if (other.conflicts != null) 406 return false; 407 } else if (!conflicts.equals(other.conflicts)) 408 return false; 409 if (listeners == null) { 410 if (other.listeners != null) 411 return false; 412 } else if (!listeners.equals(other.listeners)) 413 return false; 414 return true; 394 if (this == obj) return true; 395 if (obj == null || getClass() != obj.getClass()) return false; 396 ConflictCollection conflicts1 = (ConflictCollection) obj; 397 return Objects.equals(conflicts, conflicts1.conflicts) && 398 Objects.equals(listeners, conflicts1.listeners); 415 399 } 416 400 } -
trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java
r7509 r9371 3 3 4 4 import java.io.Serializable; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.data.osm.BBox; … … 113 114 } 114 115 115 protected final int computeHashCode(int init) {116 final int prime = 31;117 int result = init;118 long temp;119 temp = java.lang.Double.doubleToLongBits(x);120 result = prime * result + (int) (temp ^ (temp >>> 32));121 temp = java.lang.Double.doubleToLongBits(y);122 result = prime * result + (int) (temp ^ (temp >>> 32));123 return result;124 }125 126 @Override127 public int hashCode() {128 return computeHashCode(1);129 }130 131 @Override132 public boolean equals(Object obj) {133 if (this == obj)134 return true;135 if (obj == null || getClass() != obj.getClass())136 return false;137 Coordinate other = (Coordinate) obj;138 if (java.lang.Double.doubleToLongBits(x) != java.lang.Double.doubleToLongBits(other.x))139 return false;140 if (java.lang.Double.doubleToLongBits(y) != java.lang.Double.doubleToLongBits(other.y))141 return false;142 return true;143 }144 116 } -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9243 r9371 16 16 import java.util.Arrays; 17 17 import java.util.Locale; 18 import java.util.Objects; 18 19 19 20 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; … … 428 429 @Override 429 430 public int hashCode() { 430 return computeHashCode(super.hashCode());431 return Objects.hash(super.hashCode()); 431 432 } 432 433 433 434 @Override 434 435 public boolean equals(Object obj) { 435 if (this == obj) 436 return true; 437 if (!super.equals(obj)) 438 return false; 439 if (getClass() != obj.getClass()) 440 return false; 441 Coordinate other = (Coordinate) obj; 442 if (java.lang.Double.doubleToLongBits(x) != java.lang.Double.doubleToLongBits(other.x)) 443 return false; 444 if (java.lang.Double.doubleToLongBits(y) != java.lang.Double.doubleToLongBits(other.y)) 445 return false; 446 return true; 436 if (this == obj) return true; 437 if (obj == null || getClass() != obj.getClass()) return false; 438 return super.equals(obj); 447 439 } 448 440 -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r9135 r9371 134 134 @Override 135 135 public int hashCode() { 136 final int prime = 31; 137 int result = super.hashCode(); 138 result = prime * result + ((shapes == null) ? 0 : shapes.hashCode()); 139 return result; 136 return Objects.hash(super.hashCode(), shapes); 140 137 } 141 138 142 139 @Override 143 public boolean equals(Object obj) { 144 if (this == obj) 145 return true; 146 if (!super.equals(obj)) 147 return false; 148 if (getClass() != obj.getClass()) 149 return false; 150 ImageryBounds other = (ImageryBounds) obj; 151 if (shapes == null) { 152 if (other.shapes != null) 153 return false; 154 } else if (!shapes.equals(other.shapes)) 155 return false; 156 return true; 140 public boolean equals(Object o) { 141 if (this == o) return true; 142 if (o == null || getClass() != o.getClass()) return false; 143 if (!super.equals(o)) return false; 144 ImageryBounds that = (ImageryBounds) o; 145 return Objects.equals(shapes, that.shapes); 157 146 } 158 147 } … … 457 446 458 447 @Override 459 public boolean equals(Object o) { 460 if (this == o) return true; 461 if (o == null || getClass() != o.getClass()) return false; 462 463 ImageryInfo that = (ImageryInfo) o; 464 465 if (imageryType != that.imageryType) return false; 466 if (url != null ? !url.equals(that.url) : that.url != null) return false; 467 if (name != null ? !name.equals(that.name) : that.name != null) return false; 468 469 return true; 448 public int hashCode() { 449 return Objects.hash(url, imageryType); 470 450 } 471 451 … … 509 489 510 490 @Override 511 public int hashCode() { 512 int result = url != null ? url.hashCode() : 0; 513 result = 31 * result + (imageryType != null ? imageryType.hashCode() : 0); 514 return result; 491 public boolean equals(Object o) { 492 if (this == o) return true; 493 if (o == null || getClass() != o.getClass()) return false; 494 ImageryInfo that = (ImageryInfo) o; 495 return imageryType == that.imageryType && Objects.equals(url, that.url); 515 496 } 516 497 -
trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
r8510 r9371 93 93 @Override 94 94 public int hashCode() { 95 int hash = 5; 96 hash = 47 * hash + Objects.hashCode(this.coords); 97 return hash; 95 return Objects.hash(coords); 98 96 } 99 97 100 98 @Override 101 99 public boolean equals(Object obj) { 102 if (obj == null) { 103 return false; 104 } 105 if (getClass() != obj.getClass()) { 106 return false; 107 } 108 final Shape other = (Shape) obj; 109 if (!Objects.equals(this.coords, other.coords)) { 110 return false; 111 } 112 return true; 100 if (this == obj) return true; 101 if (obj == null || getClass() != obj.getClass()) return false; 102 Shape shape = (Shape) obj; 103 return Objects.equals(coords, shape.coords); 113 104 } 114 105 } -
trunk/src/org/openstreetmap/josm/data/notes/Note.java
r9070 r9371 5 5 import java.util.Date; 6 6 import java.util.List; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.data.coor.LatLon; … … 104 105 @Override 105 106 public int hashCode() { 106 final int prime = 31; 107 int result = 1; 108 result = prime * result + (int) (id ^ (id >>> 32)); 109 return result; 107 return Objects.hash(id); 110 108 } 111 109 112 /** Compares notes by OSM ID */113 110 @Override 114 111 public boolean equals(Object obj) { 115 if (this == obj) 116 return true; 117 if (obj == null) 118 return false; 119 if (getClass() != obj.getClass()) 120 return false; 121 Note other = (Note) obj; 122 if (id != other.id) 123 return false; 124 return true; 112 if (this == obj) return true; 113 if (obj == null || getClass() != obj.getClass()) return false; 114 Note note = (Note) obj; 115 return id == note.id; 125 116 } 126 117 } -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthToken.java
r9067 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.oauth; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 64 66 @Override 65 67 public int hashCode() { 66 final int prime = 31; 67 int result = 1; 68 result = prime * result + ((key == null) ? 0 : key.hashCode()); 69 result = prime * result + ((secret == null) ? 0 : secret.hashCode()); 70 return result; 68 return Objects.hash(key, secret); 71 69 } 72 70 73 71 @Override 74 72 public boolean equals(Object obj) { 75 if (this == obj) 76 return true; 77 if (obj == null) 78 return false; 79 if (getClass() != obj.getClass()) 80 return false; 81 OAuthToken other = (OAuthToken) obj; 82 if (key == null) { 83 if (other.key != null) 84 return false; 85 } else if (!key.equals(other.key)) 86 return false; 87 if (secret == null) { 88 if (other.secret != null) 89 return false; 90 } else if (!secret.equals(other.secret)) 91 return false; 92 return true; 73 if (this == obj) return true; 74 if (obj == null || getClass() != obj.getClass()) return false; 75 OAuthToken that = (OAuthToken) obj; 76 return Objects.equals(key, that.key) && 77 Objects.equals(secret, that.secret); 93 78 } 94 79 } -
trunk/src/org/openstreetmap/josm/data/osm/BBox.java
r9243 r9371 4 4 import java.awt.geom.Rectangle2D; 5 5 import java.util.Arrays; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.data.coor.LatLon; -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r8840 r9371 9 9 import java.util.List; 10 10 import java.util.Map; 11 import java.util.Objects; 11 12 12 13 import org.openstreetmap.josm.data.Bounds; … … 278 279 @Override 279 280 public int hashCode() { 280 if (id > 0) 281 return id; 282 else 283 return super.hashCode(); 281 return Objects.hash(id); 284 282 } 285 283 286 284 @Override 287 285 public boolean equals(Object obj) { 288 if (this == obj) 289 return true; 290 if (obj == null) 291 return false; 292 if (getClass() != obj.getClass()) 293 return false; 294 Changeset other = (Changeset) obj; 295 if (this.id > 0 && other.id == this.id) 296 return true; 297 return this == obj; 286 if (this == obj) return true; 287 if (obj == null || getClass() != obj.getClass()) return false; 288 Changeset changeset = (Changeset) obj; 289 return id == changeset.id; 298 290 } 299 291 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r9268 r9371 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 … … 1320 1321 @Override 1321 1322 public boolean equals(Object obj) { 1322 if (obj instanceof OsmPrimitive) 1323 return ((OsmPrimitive) obj).id == id && obj.getClass() == getClass(); 1324 return false; 1323 if (this == obj) return true; 1324 if (obj == null || getClass() != obj.getClass()) return false; 1325 OsmPrimitive that = (OsmPrimitive) obj; 1326 return Objects.equals(id, that.id); 1325 1327 } 1326 1328 … … 1331 1333 */ 1332 1334 @Override 1333 public finalint hashCode() {1334 return (int) id;1335 public int hashCode() { 1336 return Objects.hash(id); 1335 1337 } 1336 1338 -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r8510 r9371 3 3 4 4 import java.util.Arrays; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 165 166 @Override 166 167 public int hashCode() { 167 final int prime = 31; 168 int result = 1; 169 result = prime * result + member.hashCode(); 170 result = prime * result + role.hashCode(); 171 return result; 168 return Objects.hash(role, member); 172 169 } 173 170 174 171 @Override 175 172 public boolean equals(Object obj) { 176 if ( obj instanceof RelationMember) {177 RelationMember other = (RelationMember) obj;178 return member.equals(other.getMember()) && role.equals(other.getRole());179 } else180 return false;173 if (this == obj) return true; 174 if (obj == null || getClass() != obj.getClass()) return false; 175 RelationMember that = (RelationMember) obj; 176 return Objects.equals(role, that.role) && 177 Objects.equals(member, that.member); 181 178 } 182 179 -
trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java
r8846 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import java.util.Objects; 3 5 4 6 public class RelationMemberData implements PrimitiveId { … … 62 64 @Override 63 65 public int hashCode() { 64 final int prime = 31; 65 int result = 1; 66 result = prime * result + (int) (memberId ^ (memberId >>> 32)); 67 result = prime * result 68 + ((memberType == null) ? 0 : memberType.hashCode()); 69 result = prime * result + ((role == null) ? 0 : role.hashCode()); 70 return result; 66 return Objects.hash(role, memberId, memberType); 71 67 } 72 68 73 69 @Override 74 70 public boolean equals(Object obj) { 75 if (this == obj) 76 return true; 77 if (obj == null) 78 return false; 79 if (getClass() != obj.getClass()) 80 return false; 81 RelationMemberData other = (RelationMemberData) obj; 82 if (memberId != other.memberId) 83 return false; 84 if (memberType != other.memberType) 85 return false; 86 if (role == null) { 87 if (other.role != null) 88 return false; 89 } else if (!role.equals(other.role)) 90 return false; 91 return true; 71 if (this == obj) return true; 72 if (obj == null || getClass() != obj.getClass()) return false; 73 RelationMemberData that = (RelationMemberData) obj; 74 return memberId == that.memberId && 75 Objects.equals(role, that.role) && 76 memberType == that.memberType; 92 77 } 93 78 } -
trunk/src/org/openstreetmap/josm/data/osm/RelationToChildReference.java
r9067 r9371 4 4 import java.util.Collection; 5 5 import java.util.HashSet; 6 import java.util.Objects; 6 7 import java.util.Set; 7 8 … … 78 79 79 80 @Override 80 public int hashCode() {81 final int prime = 31;82 i nt result = 1;83 result = prime * result + ((child == null) ? 0 : child.hashCode());84 re sult = prime * result + ((parent == null) ? 0 : parent.hashCode());85 result = prime * result + position;86 result = prime * result + ((role == null) ? 0 : role.hashCode());87 return result;81 public boolean equals(Object obj) { 82 if (this == obj) return true; 83 if (obj == null || getClass() != obj.getClass()) return false; 84 RelationToChildReference that = (RelationToChildReference) obj; 85 return position == that.position && 86 Objects.equals(parent, that.parent) && 87 Objects.equals(role, that.role) && 88 Objects.equals(child, that.child); 88 89 } 89 90 90 91 @Override 91 public boolean equals(Object obj) { 92 if (this == obj) 93 return true; 94 if (obj == null) 95 return false; 96 if (getClass() != obj.getClass()) 97 return false; 98 RelationToChildReference other = (RelationToChildReference) obj; 99 if (child == null) { 100 if (other.child != null) 101 return false; 102 } else if (!child.equals(other.child)) 103 return false; 104 if (parent == null) { 105 if (other.parent != null) 106 return false; 107 } else if (!parent.equals(other.parent)) 108 return false; 109 if (position != other.position) 110 return false; 111 if (role == null) { 112 if (other.role != null) 113 return false; 114 } else if (!role.equals(other.role)) 115 return false; 116 return true; 92 public int hashCode() { 93 return Objects.hash(parent, position, role, child); 117 94 } 118 95 } -
trunk/src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java
r8496 r9371 5 5 import java.util.ArrayList; 6 6 import java.util.List; 7 import java.util.Objects; 7 8 import java.util.regex.MatchResult; 8 9 import java.util.regex.Matcher; … … 42 43 @Override 43 44 public int hashCode() { 44 final int prime = 31; 45 int result = 1; 46 result = prime * result + (int) (id ^ (id >>> 32)); 47 result = prime * result + ((type == null) ? 0 : type.hashCode()); 48 return result; 45 return Objects.hash(id, type); 49 46 } 50 47 51 48 @Override 52 49 public boolean equals(Object obj) { 53 if (this == obj) 54 return true; 55 if (obj == null) 56 return false; 57 if (getClass() != obj.getClass()) 58 return false; 59 SimplePrimitiveId other = (SimplePrimitiveId) obj; 60 if (id != other.id) 61 return false; 62 if (type == null) { 63 if (other.type != null) 64 return false; 65 } else if (!type.equals(other.type)) 66 return false; 67 return true; 50 if (this == obj) return true; 51 if (obj == null || getClass() != obj.getClass()) return false; 52 SimplePrimitiveId that = (SimplePrimitiveId) obj; 53 return id == that.id && 54 type == that.type; 68 55 } 69 56 -
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r8846 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 84 86 @Override 85 87 public int hashCode() { 86 final int prime = 31; 87 int result = 1; 88 result = prime * result + key.hashCode(); 89 result = prime * result + value.hashCode(); 90 return result; 88 return Objects.hash(key, value); 91 89 } 92 90 93 91 @Override 94 92 public boolean equals(Object obj) { 95 if ( obj instanceof Tag) {96 Tag other = (Tag) obj;97 return key.equals(other.getKey()) && value.equals(other.getValue());98 } else99 return false;93 if (this == obj) return true; 94 if (obj == null || getClass() != obj.getClass()) return false; 95 Tag tag = (Tag) obj; 96 return Objects.equals(key, tag.key) && 97 Objects.equals(value, tag.value); 100 98 } 101 99 -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r9243 r9371 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 … … 219 220 @Override 220 221 public int hashCode() { 221 final int prime = 31; 222 int result = 1; 223 result = prime * result + getName().hashCode(); 224 result = prime * result + (int) (uid ^ (uid >>> 32)); 225 return result; 222 return Objects.hash(uid); 226 223 } 227 224 228 225 @Override 229 226 public boolean equals(Object obj) { 230 if (!(obj instanceof User)) 231 return false; 232 User other = (User) obj; 233 if (uid != other.uid) 234 return false; 235 return true; 227 if (this == obj) return true; 228 if (obj == null || getClass() != obj.getClass()) return false; 229 User user = (User) obj; 230 return uid == user.uid; 236 231 } 237 232 -
trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java
r9243 r9371 3 3 4 4 import java.awt.geom.Line2D; 5 import java.util.Objects; 5 6 6 7 /** … … 79 80 @Override 80 81 public boolean equals(Object o) { 81 return o instanceof WaySegment 82 && ((WaySegment) o).way == way 83 && ((WaySegment) o).lowerIndex == lowerIndex; 82 if (this == o) return true; 83 if (o == null || getClass() != o.getClass()) return false; 84 WaySegment that = (WaySegment) o; 85 return lowerIndex == that.lowerIndex && 86 Objects.equals(way, that.way); 84 87 } 85 88 86 89 @Override 87 90 public int hashCode() { 88 return way.hashCode() ^ lowerIndex;91 return Objects.hash(way, lowerIndex); 89 92 } 90 93 -
trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java
r9059 r9371 5 5 import java.util.Arrays; 6 6 import java.util.List; 7 import java.util.Objects; 7 8 import java.util.Queue; 8 9 import java.util.concurrent.CopyOnWriteArrayList; … … 115 116 @Override 116 117 public int hashCode() { 117 return listener.hashCode();118 return Objects.hash(listener); 118 119 } 119 120 120 121 @Override 121 122 public boolean equals(Object o) { 122 return o instanceof ListenerInfo && ((ListenerInfo) o).listener == listener; 123 if (this == o) return true; 124 if (o == null || getClass() != o.getClass()) return false; 125 ListenerInfo that = (ListenerInfo) o; 126 return Objects.equals(listener, that.listener); 123 127 } 124 128 } -
trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java
r8836 r9371 4 4 import java.util.Collection; 5 5 import java.util.List; 6 import java.util.Objects; 6 7 import java.util.concurrent.CopyOnWriteArrayList; 7 8 … … 35 36 @Override 36 37 public int hashCode() { 37 return listener.hashCode();38 return Objects.hash(listener); 38 39 } 39 40 40 41 @Override 41 42 public boolean equals(Object o) { 42 return o instanceof ListenerInfo && ((ListenerInfo) o).listener == listener; 43 if (this == o) return true; 44 if (o == null || getClass() != o.getClass()) return false; 45 ListenerInfo that = (ListenerInfo) o; 46 return Objects.equals(listener, that.listener); 43 47 } 44 48 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r8846 r9371 10 10 import java.util.Locale; 11 11 import java.util.Map; 12 import java.util.Objects; 12 13 13 14 import org.openstreetmap.josm.data.osm.Changeset; … … 249 250 @Override 250 251 public int hashCode() { 251 final int prime = 31; 252 int result = 1; 253 result = prime * result + (int) (id ^ (id >>> 32)); 254 result = prime * result + (int) (version ^ (version >>> 32)); 255 return result; 252 return Objects.hash(id, version); 256 253 } 257 254 258 255 @Override 259 256 public boolean equals(Object obj) { 260 if (this == obj) 261 return true; 262 if (!(obj instanceof HistoryOsmPrimitive)) 263 return false; 264 // equal semantics is valid for subclasses like {@link HistoryOsmNode} etc. too. 265 // So, don't enforce equality of class. 266 HistoryOsmPrimitive other = (HistoryOsmPrimitive) obj; 267 if (id != other.id) 268 return false; 269 if (version != other.version) 270 return false; 271 return true; 257 if (this == obj) return true; 258 if (obj == null || getClass() != obj.getClass()) return false; 259 HistoryOsmPrimitive that = (HistoryOsmPrimitive) obj; 260 return id == that.id && 261 version == that.version; 272 262 } 273 263 -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r8444 r9371 7 7 import java.util.HashSet; 8 8 import java.util.List; 9 import java.util.Objects; 9 10 import java.util.Set; 10 11 … … 58 59 @Override 59 60 public int hashCode() { 60 final int prime = 31; 61 int result = 1; 62 result = prime * result + p1.hashCode(); 63 result = prime * result + color.hashCode(); 64 return result; 61 return Objects.hash(p1, color); 65 62 } 66 63 67 64 @Override 68 65 public boolean equals(Object obj) { 69 if (this == obj) 70 return true; 71 if (obj == null) 72 return false; 73 if (getClass() != obj.getClass()) 74 return false; 75 PaintedPoint other = (PaintedPoint) obj; 76 if (!p1.equals(other.p1)) 77 return false; 78 if (!color.equals(other.color)) 79 return false; 80 return true; 66 if (this == obj) return true; 67 if (obj == null || getClass() != obj.getClass()) return false; 68 PaintedPoint that = (PaintedPoint) obj; 69 return Objects.equals(p1, that.p1) && 70 Objects.equals(color, that.color); 81 71 } 82 72 } … … 92 82 @Override 93 83 public int hashCode() { 94 final int prime = 31; 95 int result = super.hashCode(); 96 result = prime * result + p2.hashCode(); 97 return result; 84 return Objects.hash(super.hashCode(), p2); 98 85 } 99 86 100 87 @Override 101 88 public boolean equals(Object obj) { 102 if (!super.equals(obj)) { 103 return false; 104 } 105 PaintedSegment other = (PaintedSegment) obj; 106 if (!p2.equals(other.p2)) 107 return false; 108 return true; 89 if (this == obj) return true; 90 if (obj == null || getClass() != obj.getClass()) return false; 91 if (!super.equals(obj)) return false; 92 PaintedSegment that = (PaintedSegment) obj; 93 return Objects.equals(p2, that.p2); 109 94 } 110 95 } -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r9345 r9371 8 8 import java.util.Collection; 9 9 import java.util.List; 10 import java.util.Objects; 10 11 11 12 import javax.swing.JCheckBox; … … 340 341 @Override 341 342 public int hashCode() { 342 final int prime = 31; 343 int result = 1; 344 result = prime * result + ((description == null) ? 0 : description.hashCode()); 345 result = prime * result + ((name == null) ? 0 : name.hashCode()); 346 return result; 343 return Objects.hash(name, description); 347 344 } 348 345 349 346 @Override 350 347 public boolean equals(Object obj) { 351 if (this == obj) 352 return true; 353 if (obj == null) 354 return false; 355 if (!(obj instanceof Test)) 356 return false; 357 Test other = (Test) obj; 358 if (description == null) { 359 if (other.description != null) 360 return false; 361 } else if (!description.equals(other.description)) 362 return false; 363 if (name == null) { 364 if (other.name != null) 365 return false; 366 } else if (!name.equals(other.name)) 367 return false; 368 return true; 348 if (this == obj) return true; 349 if (obj == null || getClass() != obj.getClass()) return false; 350 Test test = (Test) obj; 351 return Objects.equals(name, test.name) && 352 Objects.equals(description, test.description); 369 353 } 370 354 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r9067 r9371 10 10 import java.util.List; 11 11 import java.util.Map; 12 import java.util.Objects; 12 13 import java.util.Set; 13 14 … … 55 56 @Override 56 57 public int hashCode() { 57 return role.hashCode()+(int) relId+tags.hashCode()+type.hashCode()+coor.hashCode();58 return Objects.hash(role, type, tags, coor, relId); 58 59 } 59 60 60 61 @Override 61 62 public boolean equals(Object obj) { 62 if (!(obj instanceof RelMember)) return false; 63 RelMember rm = (RelMember) obj; 64 return rm.role.equals(role) && rm.type.equals(type) && rm.relId == relId && rm.tags.equals(tags) && rm.coor.equals(coor); 63 if (this == obj) return true; 64 if (obj == null || getClass() != obj.getClass()) return false; 65 RelMember relMember = (RelMember) obj; 66 return relId == relMember.relId && 67 Objects.equals(role, relMember.role) && 68 type == relMember.type && 69 Objects.equals(tags, relMember.tags) && 70 Objects.equals(coor, relMember.coor); 65 71 } 66 72 … … 117 123 @Override 118 124 public int hashCode() { 119 return members.hashCode();125 return Objects.hash(members); 120 126 } 121 127 122 128 @Override 123 129 public boolean equals(Object obj) { 124 if (!(obj instanceof RelationMembers)) return false; 125 RelationMembers rm = (RelationMembers) obj; 126 return rm.members.equals(members); 130 if (this == obj) return true; 131 if (obj == null || getClass() != obj.getClass()) return false; 132 RelationMembers that = (RelationMembers) obj; 133 return Objects.equals(members, that.members); 127 134 } 128 135 } … … 148 155 @Override 149 156 public int hashCode() { 150 return members.hashCode()+keys.hashCode();157 return Objects.hash(members, keys); 151 158 } 152 159 153 160 @Override 154 161 public boolean equals(Object obj) { 155 if (!(obj instanceof RelationPair)) return false; 156 RelationPair rp = (RelationPair) obj; 157 return rp.members.equals(members) && rp.keys.equals(keys); 162 if (this == obj) return true; 163 if (obj == null || getClass() != obj.getClass()) return false; 164 RelationPair that = (RelationPair) obj; 165 return Objects.equals(members, that.members) && 166 Objects.equals(keys, that.keys); 158 167 } 159 168 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r8850 r9371 11 11 import java.util.List; 12 12 import java.util.Map; 13 import java.util.Objects; 13 14 import java.util.Set; 14 15 … … 49 50 @Override 50 51 public int hashCode() { 51 return coor.hashCode() + keys.hashCode();52 return Objects.hash(coor, keys); 52 53 } 53 54 54 55 @Override 55 56 public boolean equals(Object obj) { 56 if (!(obj instanceof WayPair)) 57 return false; 58 WayPair wp = (WayPair) obj; 59 return wp.coor.equals(coor) && wp.keys.equals(keys); 57 if (this == obj) return true; 58 if (obj == null || getClass() != obj.getClass()) return false; 59 WayPair wayPair = (WayPair) obj; 60 return Objects.equals(coor, wayPair.coor) && 61 Objects.equals(keys, wayPair.keys); 60 62 } 61 63 } … … 74 76 @Override 75 77 public int hashCode() { 76 return coor.hashCode();78 return Objects.hash(coor); 77 79 } 78 80 79 81 @Override 80 82 public boolean equals(Object obj) { 81 if (!(obj instanceof WayPairNoTags)) return false; 82 WayPairNoTags wp = (WayPairNoTags) obj; 83 return wp.coor.equals(coor); 83 if (this == obj) return true; 84 if (obj == null || getClass() != obj.getClass()) return false; 85 WayPairNoTags that = (WayPairNoTags) obj; 86 return Objects.equals(coor, that.coor); 84 87 } 85 88 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r9359 r9371 23 23 import java.util.Locale; 24 24 import java.util.Map; 25 import java.util.Objects; 25 26 import java.util.Set; 26 27 import java.util.regex.Matcher; … … 95 96 @Override 96 97 public int hashCode() { 97 final int prime = 31; 98 int result = 1; 99 result = prime * result + ((declaration == null) ? 0 : declaration.hashCode()); 100 result = prime * result + ((selectors == null) ? 0 : selectors.hashCode()); 101 return result; 98 return Objects.hash(selectors, declaration); 102 99 } 103 100 104 101 @Override 105 102 public boolean equals(Object obj) { 106 if (this == obj) 107 return true; 108 if (obj == null) 109 return false; 110 if (!(obj instanceof GroupedMapCSSRule)) 111 return false; 112 GroupedMapCSSRule other = (GroupedMapCSSRule) obj; 113 if (declaration == null) { 114 if (other.declaration != null) 115 return false; 116 } else if (!declaration.equals(other.declaration)) 117 return false; 118 if (selectors == null) { 119 if (other.selectors != null) 120 return false; 121 } else if (!selectors.equals(other.selectors)) 122 return false; 123 return true; 103 if (this == obj) return true; 104 if (obj == null || getClass() != obj.getClass()) return false; 105 GroupedMapCSSRule that = (GroupedMapCSSRule) obj; 106 return Objects.equals(selectors, that.selectors) && 107 Objects.equals(declaration, that.declaration); 124 108 } 125 109 … … 660 644 @Override 661 645 public int hashCode() { 662 final int prime = 31; 663 int result = super.hashCode(); 664 result = prime * result + ((rule == null) ? 0 : rule.hashCode()); 665 return result; 646 return Objects.hash(super.hashCode(), rule); 666 647 } 667 648 … … 825 806 @Override 826 807 public synchronized int hashCode() { 827 final int prime = 31; 828 int result = super.hashCode(); 829 result = prime * result + ((checks == null) ? 0 : checks.hashCode()); 830 return result; 808 return Objects.hash(super.hashCode(), checks); 831 809 } 832 810 833 811 @Override 834 812 public synchronized boolean equals(Object obj) { 835 if (this == obj) 836 return true; 837 if (!super.equals(obj)) 838 return false; 839 if (!(obj instanceof MapCSSTagChecker)) 840 return false; 841 MapCSSTagChecker other = (MapCSSTagChecker) obj; 842 if (checks == null) { 843 if (other.checks != null) 844 return false; 845 } else if (!checks.equals(other.checks)) 846 return false; 847 return true; 813 if (this == obj) return true; 814 if (obj == null || getClass() != obj.getClass()) return false; 815 if (!super.equals(obj)) return false; 816 MapCSSTagChecker that = (MapCSSTagChecker) obj; 817 return Objects.equals(checks, that.checks); 848 818 } 849 819 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java
r9078 r9371 4 4 import static org.openstreetmap.josm.gui.conflict.tags.RelationMemberConflictDecisionType.UNDECIDED; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 import java.util.Objects; 6 8 7 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 72 74 @Override 73 75 public int hashCode() { 74 final int prime = 31; 75 int result = 1; 76 result = prime * result + ((decision == null) ? 0 : decision.hashCode()); 77 result = prime * result + ((originalPrimitive == null) ? 0 : originalPrimitive.hashCode()); 78 result = prime * result + pos; 79 result = prime * result + ((relation == null) ? 0 : relation.hashCode()); 80 result = prime * result + ((role == null) ? 0 : role.hashCode()); 81 return result; 76 return Objects.hash(relation, pos, originalPrimitive, role, decision); 82 77 } 83 78 84 79 @Override 85 80 public boolean equals(Object obj) { 86 if (this == obj) 87 return true; 88 if (obj == null) 89 return false; 90 if (getClass() != obj.getClass()) 91 return false; 92 RelationMemberConflictDecision other = (RelationMemberConflictDecision) obj; 93 if (decision == null) { 94 if (other.decision != null) 95 return false; 96 } else if (!decision.equals(other.decision)) 97 return false; 98 if (originalPrimitive == null) { 99 if (other.originalPrimitive != null) 100 return false; 101 } else if (!originalPrimitive.equals(other.originalPrimitive)) 102 return false; 103 if (pos != other.pos) 104 return false; 105 if (relation == null) { 106 if (other.relation != null) 107 return false; 108 } else if (!relation.equals(other.relation)) 109 return false; 110 if (role == null) { 111 if (other.role != null) 112 return false; 113 } else if (!role.equals(other.role)) 114 return false; 115 return true; 81 if (this == obj) return true; 82 if (obj == null || getClass() != obj.getClass()) return false; 83 RelationMemberConflictDecision that = (RelationMemberConflictDecision) obj; 84 return pos == that.pos && 85 Objects.equals(relation, that.relation) && 86 Objects.equals(originalPrimitive, that.originalPrimitive) && 87 Objects.equals(role, that.role) && 88 decision == that.decision; 116 89 } 117 90 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
r9246 r9371 54 54 @Override 55 55 public int hashCode() { 56 final int prime = 31; 57 int result = 1; 58 result = prime * result + ((layer == null) ? 0 : layer.hashCode()); 59 result = prime * result + ((relation == null) ? 0 : relation.hashCode()); 60 return result; 56 return Objects.hash(relation, layer); 61 57 } 62 58 63 59 @Override 64 60 public boolean equals(Object obj) { 65 if (this == obj) 66 return true; 67 if (obj == null) 68 return false; 69 if (getClass() != obj.getClass()) 70 return false; 71 DialogContext other = (DialogContext) obj; 72 if (layer == null) { 73 if (other.layer != null) 74 return false; 75 } else if (!layer.equals(other.layer)) 76 return false; 77 if (relation == null) { 78 if (other.relation != null) 79 return false; 80 } else if (!relation.equals(other.relation)) 81 return false; 82 return true; 61 if (this == obj) return true; 62 if (obj == null || getClass() != obj.getClass()) return false; 63 DialogContext that = (DialogContext) obj; 64 return Objects.equals(relation, that.relation) && 65 Objects.equals(layer, that.layer); 83 66 } 84 67 -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r8836 r9371 12 12 import java.util.List; 13 13 import java.util.Locale; 14 import java.util.Objects; 14 15 15 16 import javax.swing.DefaultListModel; … … 79 80 @Override 80 81 public int hashCode() { 81 final int prime = 31; 82 int result = 1; 83 result = prime * result + ((area == null) ? 0 : area.hashCode()); 84 result = prime * result + ((name == null) ? 0 : name.hashCode()); 85 return result; 82 return Objects.hash(name, area); 86 83 } 87 84 88 85 @Override 89 86 public boolean equals(Object obj) { 90 if (this == obj) 91 return true; 92 if (obj == null) 93 return false; 94 if (getClass() != obj.getClass()) 95 return false; 96 Bookmark other = (Bookmark) obj; 97 if (area == null) { 98 if (other.area != null) 99 return false; 100 } else if (!area.equals(other.area)) 101 return false; 102 if (name == null) { 103 if (other.name != null) 104 return false; 105 } else if (!name.equals(other.name)) 106 return false; 107 return true; 87 if (this == obj) return true; 88 if (obj == null || getClass() != obj.getClass()) return false; 89 Bookmark bookmark = (Bookmark) obj; 90 return Objects.equals(name, bookmark.name) && 91 Objects.equals(area, bookmark.area); 108 92 } 109 93 -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySpecification.java
r8510 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.io; 3 4 import java.util.Objects; 3 5 4 6 /** … … 107 109 @Override 108 110 public int hashCode() { 109 final int prime = 31; 110 int result = 1; 111 result = prime * result + chunkSize; 112 result = prime * result + (closeChangesetAfterUpload ? 1231 : 1237); 113 result = prime * result + ((policy == null) ? 0 : policy.hashCode()); 114 result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); 115 return result; 111 return Objects.hash(strategy, chunkSize, policy, closeChangesetAfterUpload); 116 112 } 117 113 118 114 @Override 119 115 public boolean equals(Object obj) { 120 if (this == obj) 121 return true; 122 if (obj == null) 123 return false; 124 if (getClass() != obj.getClass()) 125 return false; 126 UploadStrategySpecification other = (UploadStrategySpecification) obj; 127 if (chunkSize != other.chunkSize) 128 return false; 129 if (closeChangesetAfterUpload != other.closeChangesetAfterUpload) 130 return false; 131 if (policy == null) { 132 if (other.policy != null) 133 return false; 134 } else if (!policy.equals(other.policy)) 135 return false; 136 if (strategy == null) { 137 if (other.strategy != null) 138 return false; 139 } else if (!strategy.equals(other.strategy)) 140 return false; 141 return true; 116 if (this == obj) return true; 117 if (obj == null || getClass() != obj.getClass()) return false; 118 UploadStrategySpecification that = (UploadStrategySpecification) obj; 119 return chunkSize == that.chunkSize && 120 closeChangesetAfterUpload == that.closeChangesetAfterUpload && 121 strategy == that.strategy && 122 policy == that.policy; 142 123 } 143 124 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
r9341 r9371 4 4 import java.util.ArrayList; 5 5 import java.util.List; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; … … 176 177 @Override 177 178 public boolean equals(Object obj) { 178 if (obj == null || getClass() != obj.getClass()) 179 return false; 180 final DividedScale other = (DividedScale) obj; 181 return bd.equals(other.bd) && data.equals(other.data); 179 if (this == obj) return true; 180 if (obj == null || getClass() != obj.getClass()) return false; 181 DividedScale<?> that = (DividedScale<?>) obj; 182 return Objects.equals(bd, that.bd) && 183 Objects.equals(data, that.data); 182 184 } 183 185 184 186 @Override 185 187 public int hashCode() { 186 int hash = 7; 187 hash = 23 * hash + bd.hashCode(); 188 hash = 23 * hash + data.hashCode(); 189 return hash; 188 return Objects.hash(bd, data); 190 189 } 191 190 -
trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java
r8404 r9371 19 19 @Override 20 20 public boolean equals(Object obj) { 21 if (obj == null || getClass() != obj.getClass()) 22 return false; 23 return Objects.equals(val, ((Keyword) obj).val); 21 if (this == obj) return true; 22 if (obj == null || getClass() != obj.getClass()) return false; 23 Keyword keyword = (Keyword) obj; 24 return Objects.equals(val, keyword.val); 24 25 } 25 26 26 27 @Override 27 28 public int hashCode() { 28 return val.hashCode();29 return Objects.hash(val); 29 30 } 30 31 -
trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java
r9239 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import java.util.Objects; 3 5 4 6 /** … … 91 93 if (this == o) return true; 92 94 if (o == null || getClass() != o.getClass()) return false; 93 94 95 Range range = (Range) o; 95 96 if (Double.compare(range.lower, lower) != 0) return false; 97 if (Double.compare(range.upper, upper) != 0) return false; 98 99 return true; 96 return Double.compare(range.lower, lower) == 0 && 97 Double.compare(range.upper, upper) == 0; 100 98 } 101 99 102 100 @Override 103 101 public int hashCode() { 104 int result; 105 long temp; 106 temp = Double.doubleToLongBits(lower); 107 result = (int) (temp ^ (temp >>> 32)); 108 temp = Double.doubleToLongBits(upper); 109 result = 31 * result + (int) (temp ^ (temp >>> 32)); 110 return result; 102 return Objects.hash(lower, upper); 111 103 } 112 104 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleElementList.java
r9284 r9371 57 57 @Override 58 58 public boolean equals(Object obj) { 59 if (obj == null || getClass() != obj.getClass()) { 60 return false; 61 } 62 final StyleElementList other = (StyleElementList) obj; 63 return Objects.equals(lst, other.lst); 59 if (this == obj) return true; 60 if (obj == null || getClass() != obj.getClass()) return false; 61 StyleElementList that = (StyleElementList) obj; 62 return Objects.equals(lst, that.lst); 64 63 } 65 64 66 65 @Override 67 66 public int hashCode() { 68 return lst.hashCode();67 return Objects.hash(lst); 69 68 } 70 71 69 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
r8846 r9371 3 3 4 4 import java.util.List; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.gui.mappaint.Environment; … … 42 43 @Override 43 44 public int hashCode() { 44 final int prime = 31; 45 int result = 1; 46 result = prime * result + idx; 47 result = prime * result + ((instructions == null) ? 0 : instructions.hashCode()); 48 return result; 45 return Objects.hash(instructions, idx); 49 46 } 50 47 51 48 @Override 52 49 public boolean equals(Object obj) { 53 if (this == obj) 54 return true; 55 if (obj == null) 56 return false; 57 if (!(obj instanceof Declaration)) 58 return false; 59 Declaration other = (Declaration) obj; 60 if (idx != other.idx) 61 return false; 62 if (instructions == null) { 63 if (other.instructions != null) 64 return false; 65 } else if (!instructions.equals(other.instructions)) 66 return false; 67 return true; 50 if (this == obj) return true; 51 if (obj == null || getClass() != obj.getClass()) return false; 52 Declaration that = (Declaration) obj; 53 return idx == that.idx && 54 Objects.equals(instructions, that.instructions); 68 55 } 69 56 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r9341 r9371 117 117 @Override 118 118 public boolean equals(Object obj) { 119 if (obj == null || getClass() != obj.getClass()) 120 return false; 121 if (!super.equals(obj)) 122 return false; 123 AreaElement other = (AreaElement) obj; 124 // we should get the same image object due to caching 125 if (!Objects.equals(fillImage, other.fillImage)) 126 return false; 127 if (!Objects.equals(color, other.color)) 128 return false; 129 if (!Objects.equals(extent, other.extent)) 130 return false; 131 if (!Objects.equals(extentThreshold, other.extentThreshold)) 132 return false; 133 if (!Objects.equals(text, other.text)) 134 return false; 135 return true; 119 if (this == obj) return true; 120 if (obj == null || getClass() != obj.getClass()) return false; 121 if (!super.equals(obj)) return false; 122 AreaElement that = (AreaElement) obj; 123 return Objects.equals(color, that.color) && 124 Objects.equals(fillImage, that.fillImage) && 125 Objects.equals(text, that.text) && 126 Objects.equals(extent, that.extent) && 127 Objects.equals(extentThreshold, that.extentThreshold); 136 128 } 137 129 138 130 @Override 139 131 public int hashCode() { 140 int hash = super.hashCode(); 141 hash = 61 * hash + color.hashCode(); 142 hash = 61 * hash + (extent != null ? Float.floatToIntBits(extent) : 0); 143 hash = 61 * hash + (extentThreshold != null ? Float.floatToIntBits(extentThreshold) : 0); 144 hash = 61 * hash + (fillImage != null ? fillImage.hashCode() : 0); 145 hash = 61 * hash + (text != null ? text.hashCode() : 0); 146 return hash; 132 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold); 147 133 } 148 134 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java
r9278 r9371 4 4 import java.awt.Color; 5 5 import java.awt.Rectangle; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.data.osm.Node; … … 73 74 @Override 74 75 public int hashCode() { 75 return box.hashCode();76 return Objects.hash(box); 76 77 } 77 78 78 79 @Override 79 80 public boolean equals(Object obj) { 80 if (!(obj instanceof BoxProvider)) 81 return false; 82 final BoxProvider other = (BoxProvider) obj; 83 BoxProviderResult resultOther = other.get(); 84 if (resultOther.isTemporary()) return false; 85 return box.equals(resultOther.getBox()); 81 if (this == obj) return true; 82 if (obj == null || getClass() != obj.getClass()) return false; 83 SimpleBoxProvider that = (SimpleBoxProvider) obj; 84 return Objects.equals(box, that.box); 86 85 } 87 86 } … … 207 206 @Override 208 207 public boolean equals(Object obj) { 209 if (!super.equals(obj)) 210 return false; 211 if (obj == null || getClass() != obj.getClass()) 212 return false; 213 final BoxTextElement other = (BoxTextElement) obj; 214 if (!text.equals(other.text)) return false; 215 if (boxProvider != null) { 216 if (!boxProvider.equals(other.boxProvider)) return false; 217 } else if (other.boxProvider != null) 218 return false; 219 else { 220 if (!box.equals(other.box)) return false; 221 } 222 if (hAlign != other.hAlign) return false; 223 if (vAlign != other.vAlign) return false; 224 return true; 208 if (this == obj) return true; 209 if (obj == null || getClass() != obj.getClass()) return false; 210 if (!super.equals(obj)) return false; 211 BoxTextElement that = (BoxTextElement) obj; 212 return Objects.equals(text, that.text) && 213 Objects.equals(boxProvider, that.boxProvider) && 214 Objects.equals(box, that.box) && 215 hAlign == that.hAlign && 216 vAlign == that.vAlign; 225 217 } 226 218 227 219 @Override 228 220 public int hashCode() { 229 int hash = super.hashCode(); 230 hash = 97 * hash + text.hashCode(); 231 if (boxProvider != null) { 232 hash = 97 * hash + boxProvider.hashCode(); 233 } else { 234 hash = 97 * hash + box.hashCode(); 235 } 236 hash = 97 * hash + hAlign.hashCode(); 237 hash = 97 * hash + vAlign.hashCode(); 238 return hash; 221 return Objects.hash(super.hashCode(), text, boxProvider, box, hAlign, vAlign); 239 222 } 240 223 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java
r9278 r9371 6 6 import java.util.Collections; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import org.openstreetmap.josm.Main; … … 70 71 @Override 71 72 public int hashCode() { 72 final int prime = 31; 73 int result = 1; 74 result = prime * result + ((defaultLabel == null) ? 0 : defaultLabel.hashCode()); 75 return result; 73 return Objects.hash(defaultLabel); 76 74 } 77 75 78 76 @Override 79 77 public boolean equals(Object obj) { 80 if (this == obj) 81 return true; 82 if (obj == null) 83 return false; 84 if (getClass() != obj.getClass()) 85 return false; 86 StaticLabelCompositionStrategy other = (StaticLabelCompositionStrategy) obj; 87 if (defaultLabel == null) { 88 if (other.defaultLabel != null) 89 return false; 90 } else if (!defaultLabel.equals(other.defaultLabel)) 91 return false; 92 return true; 78 if (this == obj) return true; 79 if (obj == null || getClass() != obj.getClass()) return false; 80 StaticLabelCompositionStrategy that = (StaticLabelCompositionStrategy) obj; 81 return Objects.equals(defaultLabel, that.defaultLabel); 93 82 } 94 83 } … … 126 115 @Override 127 116 public int hashCode() { 128 final int prime = 31; 129 int result = 1; 130 result = prime * result + ((defaultLabelTag == null) ? 0 : defaultLabelTag.hashCode()); 131 return result; 117 return Objects.hash(defaultLabelTag); 132 118 } 133 119 134 120 @Override 135 121 public boolean equals(Object obj) { 136 if (this == obj) 137 return true; 138 if (obj == null) 139 return false; 140 if (getClass() != obj.getClass()) 141 return false; 142 TagLookupCompositionStrategy other = (TagLookupCompositionStrategy) obj; 143 if (defaultLabelTag == null) { 144 if (other.defaultLabelTag != null) 145 return false; 146 } else if (!defaultLabelTag.equals(other.defaultLabelTag)) 147 return false; 148 return true; 122 if (this == obj) return true; 123 if (obj == null || getClass() != obj.getClass()) return false; 124 TagLookupCompositionStrategy that = (TagLookupCompositionStrategy) obj; 125 return Objects.equals(defaultLabelTag, that.defaultLabelTag); 149 126 } 150 127 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java
r9341 r9371 359 359 @Override 360 360 public int hashCode() { 361 int hash = super.hashCode(); 362 hash = 29 * hash + line.hashCode(); 363 hash = 29 * hash + color.hashCode(); 364 hash = 29 * hash + (dashesLine != null ? dashesLine.hashCode() : 0); 365 hash = 29 * hash + (dashesBackground != null ? dashesBackground.hashCode() : 0); 366 hash = 29 * hash + Float.floatToIntBits(offset); 367 hash = 29 * hash + Float.floatToIntBits(realWidth); 368 hash = 29 * hash + (this.wayDirectionArrows ? 1 : 0); 369 return hash; 361 return Objects.hash(super.hashCode(), line, color, dashesBackground, offset, realWidth, wayDirectionArrows, dashesLine); 370 362 } 371 363 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineTextElement.java
r9341 r9371 44 44 @Override 45 45 public boolean equals(Object obj) { 46 if (obj == null || getClass() != obj.getClass()) 47 return false; 48 if (!super.equals(obj)) 49 return false; 50 final LineTextElement other = (LineTextElement) obj; 51 return Objects.equals(text, other.text); 46 if (this == obj) return true; 47 if (obj == null || getClass() != obj.getClass()) return false; 48 if (!super.equals(obj)) return false; 49 LineTextElement that = (LineTextElement) obj; 50 return Objects.equals(text, that.text); 52 51 } 53 52 54 53 @Override 55 54 public int hashCode() { 56 int hash = super.hashCode(); 57 hash = 43 * hash + text.hashCode(); 58 return hash; 55 return Objects.hash(super.hashCode(), text); 59 56 } 60 57 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r9334 r9371 217 217 @Override 218 218 public boolean equals(Object obj) { 219 if (obj == null || getClass() != obj.getClass()) 220 return false; 221 final MapImage other = (MapImage) obj; 222 // img changes when image is fully loaded and can't be used for equality check. 223 return alpha == other.alpha && 224 Objects.equals(name, other.name) && 225 Objects.equals(source, other.source) && 226 autoRescale == other.autoRescale && 227 width == other.width && 228 height == other.height; 219 if (this == obj) return true; 220 if (obj == null || getClass() != obj.getClass()) return false; 221 MapImage mapImage = (MapImage) obj; 222 return alpha == mapImage.alpha && 223 autoRescale == mapImage.autoRescale && 224 width == mapImage.width && 225 height == mapImage.height && 226 Objects.equals(name, mapImage.name) && 227 Objects.equals(source, mapImage.source); 229 228 } 230 229 231 230 @Override 232 231 public int hashCode() { 233 int hash = 7; 234 hash = 67 * hash + alpha; 235 hash = 67 * hash + name.hashCode(); 236 hash = 67 * hash + source.hashCode(); 237 hash = 67 * hash + (autoRescale ? 1 : 0); 238 hash = 67 * hash + width; 239 hash = 67 * hash + height; 240 return hash; 232 return Objects.hash(alpha, name, source, autoRescale, width, height); 241 233 } 242 234 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r9341 r9371 68 68 @Override 69 69 public int hashCode() { 70 int hash = 7; 71 hash = 67 * hash + symbol.hashCode(); 72 hash = 67 * hash + size; 73 hash = 67 * hash + (stroke != null ? stroke.hashCode() : 0); 74 hash = 67 * hash + (strokeColor != null ? strokeColor.hashCode() : 0); 75 hash = 67 * hash + (fillColor != null ? fillColor.hashCode() : 0); 76 return hash; 70 return Objects.hash(symbol, size, stroke, strokeColor, fillColor); 77 71 } 78 72 … … 364 358 @Override 365 359 public int hashCode() { 366 int hash = super.hashCode(); 367 hash = 17 * hash + (mapImage != null ? mapImage.hashCode() : 0); 368 hash = 17 * hash + (symbol != null ? symbol.hashCode() : 0); 369 hash = 17 * hash + (mapImageAngle != null ? mapImageAngle.hashCode() : 0); 370 return hash; 360 return Objects.hash(super.hashCode(), mapImage, mapImageAngle, symbol); 371 361 } 372 362 373 363 @Override 374 364 public boolean equals(Object obj) { 375 if (obj == null || getClass() != obj.getClass()) 376 return false; 377 if (!super.equals(obj)) 378 return false; 379 380 final NodeElement other = (NodeElement) obj; 381 // we should get the same image object due to caching 382 if (!Objects.equals(mapImage, other.mapImage)) 383 return false; 384 if (!Objects.equals(symbol, other.symbol)) 385 return false; 386 if (!Objects.equals(mapImageAngle, other.mapImageAngle)) 387 return false; 388 return true; 365 if (this == obj) return true; 366 if (obj == null || getClass() != obj.getClass()) return false; 367 if (!super.equals(obj)) return false; 368 NodeElement that = (NodeElement) obj; 369 return Objects.equals(mapImage, that.mapImage) && 370 Objects.equals(mapImageAngle, that.mapImageAngle) && 371 Objects.equals(symbol, that.symbol); 389 372 } 390 373 391 374 @Override 375 392 376 public String toString() { 393 377 StringBuilder s = new StringBuilder("NodeElemStyle{"); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java
r9341 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint.styleelement; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 66 68 @Override 67 69 public boolean equals(Object obj) { 68 if (obj == null || getClass() != obj.getClass()) 69 return false; 70 if (!super.equals(obj)) 71 return false; 72 final RepeatImageElement other = (RepeatImageElement) obj; 73 if (!this.pattern.equals(other.pattern)) return false; 74 if (this.offset != other.offset) return false; 75 if (this.spacing != other.spacing) return false; 76 if (this.phase != other.phase) return false; 77 if (this.align != other.align) return false; 78 return true; 70 if (this == obj) return true; 71 if (obj == null || getClass() != obj.getClass()) return false; 72 if (!super.equals(obj)) return false; 73 RepeatImageElement that = (RepeatImageElement) obj; 74 return Float.compare(that.offset, offset) == 0 && 75 Float.compare(that.spacing, spacing) == 0 && 76 Float.compare(that.phase, phase) == 0 && 77 Objects.equals(pattern, that.pattern) && 78 align == that.align; 79 79 } 80 80 81 81 @Override 82 82 public int hashCode() { 83 int hash = super.hashCode(); 84 hash = 83 * hash + this.pattern.hashCode(); 85 hash = 83 * hash + Float.floatToIntBits(this.offset); 86 hash = 83 * hash + Float.floatToIntBits(this.spacing); 87 hash = 83 * hash + Float.floatToIntBits(this.phase); 88 hash = 83 * hash + this.align.hashCode(); 89 return hash; 83 return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, align); 90 84 } 91 85 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r9341 r9371 5 5 import java.util.HashMap; 6 6 import java.util.Map; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.Main; … … 147 148 @Override 148 149 public int hashCode() { 149 final int prime = 31; 150 int result = 1; 151 result = prime * result + ((name == null) ? 0 : name.hashCode()); 152 result = prime * result + size; 153 result = prime * result + style; 154 return result; 150 return Objects.hash(name, style, size); 155 151 } 156 152 157 153 @Override 158 154 public boolean equals(Object obj) { 159 if (this == obj) 160 return true; 161 if (obj == null) 162 return false; 163 if (getClass() != obj.getClass()) 164 return false; 165 FontDescriptor other = (FontDescriptor) obj; 166 if (name == null) { 167 if (other.name != null) 168 return false; 169 } else if (!name.equals(other.name)) 170 return false; 171 if (size != other.size) 172 return false; 173 if (style != other.style) 174 return false; 175 return true; 155 if (this == obj) return true; 156 if (obj == null || getClass() != obj.getClass()) return false; 157 FontDescriptor that = (FontDescriptor) obj; 158 return style == that.style && 159 size == that.size && 160 Objects.equals(name, that.name); 176 161 } 177 162 } … … 214 199 @Override 215 200 public boolean equals(Object o) { 216 if ( !(o instanceof StyleElement))217 218 StyleElement s= (StyleElement) o;219 return isModifier == s.isModifier&&220 majorZIndex == s.majorZIndex&&221 zIndex == s.zIndex&&222 objectZIndex == s.objectZIndex;201 if (this == o) return true; 202 if (o == null || getClass() != o.getClass()) return false; 203 StyleElement that = (StyleElement) o; 204 return Float.compare(that.majorZIndex, majorZIndex) == 0 && 205 Float.compare(that.zIndex, zIndex) == 0 && 206 Float.compare(that.objectZIndex, objectZIndex) == 0 && 207 isModifier == that.isModifier; 223 208 } 224 209 225 210 @Override 226 211 public int hashCode() { 227 int hash = 5; 228 hash = 41 * hash + Float.floatToIntBits(this.majorZIndex); 229 hash = 41 * hash + Float.floatToIntBits(this.zIndex); 230 hash = 41 * hash + Float.floatToIntBits(this.objectZIndex); 231 hash = 41 * hash + (isModifier ? 1 : 0); 232 return hash; 212 return Objects.hash(majorZIndex, zIndex, objectZIndex, isModifier); 233 213 } 234 214 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r9278 r9371 201 201 @Override 202 202 public int hashCode() { 203 int hash = 3; 204 hash = 79 * hash + (labelCompositionStrategy != null ? labelCompositionStrategy.hashCode() : 0); 205 hash = 79 * hash + font.hashCode(); 206 hash = 79 * hash + xOffset; 207 hash = 79 * hash + yOffset; 208 hash = 79 * hash + color.hashCode(); 209 hash = 79 * hash + (haloRadius != null ? Float.floatToIntBits(haloRadius) : 0); 210 hash = 79 * hash + (haloColor != null ? haloColor.hashCode() : 0); 211 return hash; 203 return Objects.hash(labelCompositionStrategy, font, xOffset, yOffset, color, haloRadius, haloColor); 212 204 } 213 205 214 206 @Override 215 207 public boolean equals(Object obj) { 216 if ( obj == null || getClass() != obj.getClass())217 218 final TextLabel other= (TextLabel) obj;219 return Objects.equals(labelCompositionStrategy, other.labelCompositionStrategy)&&220 Objects.equals(font, other.font)&&221 xOffset == other.xOffset&&222 yOffset == other.yOffset&&223 Objects.equals(color, other.color) &&224 Objects.equals(haloRadius, other.haloRadius) &&225 Objects.equals(haloColor, other.haloColor);208 if (this == obj) return true; 209 if (obj == null || getClass() != obj.getClass()) return false; 210 TextLabel textLabel = (TextLabel) obj; 211 return xOffset == textLabel.xOffset && 212 yOffset == textLabel.yOffset && 213 Objects.equals(labelCompositionStrategy, textLabel.labelCompositionStrategy) && 214 Objects.equals(font, textLabel.font) && 215 Objects.equals(color, textLabel.color) && 216 Objects.equals(haloRadius, textLabel.haloRadius) && 217 Objects.equals(haloColor, textLabel.haloColor); 226 218 } 227 219 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r8377 r9371 109 109 @Override 110 110 public boolean equals(Object obj) { 111 if ( obj == null || getClass() != obj.getClass())112 113 final SourceEntry other= (SourceEntry) obj;114 return Objects.equals(other.url, url)&&115 other.isZip == isZip&&116 Objects.equals( other.zipEntryPath, zipEntryPath) &&117 Objects.equals( other.name, name) &&118 Objects.equals( other.title, title) &&119 other.active == active;111 if (this == obj) return true; 112 if (obj == null || getClass() != obj.getClass()) return false; 113 SourceEntry that = (SourceEntry) obj; 114 return isZip == that.isZip && 115 active == that.active && 116 Objects.equals(url, that.url) && 117 Objects.equals(zipEntryPath, that.zipEntryPath) && 118 Objects.equals(name, that.name) && 119 Objects.equals(title, that.title); 120 120 } 121 121 122 122 @Override 123 123 public int hashCode() { 124 int hash = 5; 125 hash = 89 * hash + (this.url != null ? this.url.hashCode() : 0); 126 hash = 89 * hash + (this.isZip ? 1 : 0); 127 hash = 89 * hash + (this.zipEntryPath != null ? this.zipEntryPath.hashCode() : 0); 128 hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0); 129 hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0); 130 hash = 89 * hash + (this.active ? 1 : 0); 131 return hash; 124 return Objects.hash(url, isZip, zipEntryPath, name, title, active); 132 125 } 133 126 -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskId.java
r8846 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.progress; 3 4 import java.util.Objects; 3 5 4 6 public class ProgressTaskId { … … 16 18 @Override 17 19 public int hashCode() { 18 return id.hashCode();20 return Objects.hash(id); 19 21 } 20 22 21 23 @Override 22 24 public boolean equals(Object obj) { 23 if (this == obj) 24 return true; 25 if (obj == null) 26 return false; 27 if (getClass() != obj.getClass()) 28 return false; 29 ProgressTaskId other = (ProgressTaskId) obj; 30 return other.id.equals(id); 25 if (this == obj) return true; 26 if (obj == null || getClass() != obj.getClass()) return false; 27 ProgressTaskId that = (ProgressTaskId) obj; 28 return Objects.equals(id, that.id); 31 29 } 32 30 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r9266 r9371 84 84 @Override 85 85 public int hashCode() { 86 int hash = 7; 87 hash = 59 * hash + Objects.hashCode(this.key); 88 hash = 59 * hash + Objects.hashCode(this.value); 89 hash = 59 * hash + (this.defaultKey ? 1 : 0); 90 return hash; 86 return Objects.hash(key, value, defaultKey); 91 87 } 92 88 -
trunk/src/org/openstreetmap/josm/tools/MultiMap.java
r9074 r9371 9 9 import java.util.Map; 10 10 import java.util.Map.Entry; 11 import java.util.Objects; 11 12 import java.util.Set; 12 13 … … 214 215 @Override 215 216 public int hashCode() { 216 return map.hashCode();217 return Objects.hash(map); 217 218 } 218 219 219 220 @Override 220 221 public boolean equals(Object obj) { 221 if (this == obj) 222 return true; 223 if (obj == null) 224 return false; 225 if (!(obj instanceof MultiMap)) 226 return false; 227 return map.equals(((MultiMap<?, ?>) obj).map); 222 if (this == obj) return true; 223 if (obj == null || getClass() != obj.getClass()) return false; 224 MultiMap<?, ?> multiMap = (MultiMap<?, ?>) obj; 225 return Objects.equals(map, multiMap.map); 228 226 } 229 227 230 228 @Override 229 231 230 public String toString() { 232 231 List<String> entries = new ArrayList<>(map.size()); -
trunk/src/org/openstreetmap/josm/tools/Pair.java
r9246 r9371 3 3 import java.util.ArrayList; 4 4 import java.util.List; 5 import java.util.Objects; 5 6 6 7 /** … … 34 35 @Override 35 36 public int hashCode() { 36 return a.hashCode() + b.hashCode();37 return Objects.hash(a, b); 37 38 } 38 39 39 40 @Override 40 41 public boolean equals(Object other) { 41 if ( other instanceof Pair<?, ?>) {42 Pair<?, ?> o = (Pair<?, ?>) other;43 return a.equals(o.a) && b.equals(o.b);44 } else45 return false;42 if (this == other) return true; 43 if (other == null || getClass() != other.getClass()) return false; 44 Pair<?, ?> pair = (Pair<?, ?>) other; 45 return Objects.equals(a, pair.a) && 46 Objects.equals(b, pair.b); 46 47 } 47 48
Note:
See TracChangeset
for help on using the changeset viewer.