Changeset 9371 in josm for trunk/src/org/openstreetmap/josm/data/coor
- Timestamp:
- 2016-01-09T23:20:37+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/coor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.