Changeset 8447 in josm for trunk/src/org/openstreetmap/josm/command/MoveCommand.java
- Timestamp:
- 2015-06-03T00:06:52+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r8285 r8447 66 66 * Constructs a new {@code MoveCommand} to move a node. 67 67 * @param node The node to move 68 * @param position The new location (lat/lon) 68 69 */ 69 70 public MoveCommand(Node node, LatLon position) { … … 97 98 } 98 99 100 /** 101 * Constructs a new {@code MoveCommand} to move a collection of primitives. 102 * @param objects The primitives to move 103 * @param start The starting position (northern/eastern) 104 * @param end The ending position (northern/eastern) 105 */ 99 106 public MoveCommand(Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) { 100 107 this(objects, end.getX()-start.getX(), end.getY()-start.getY()); … … 102 109 } 103 110 111 /** 112 * Constructs a new {@code MoveCommand} to move a primitive. 113 * @param p The primitive to move 114 * @param start The starting position (northern/eastern) 115 * @param end The ending position (northern/eastern) 116 */ 104 117 public MoveCommand(OsmPrimitive p, EastNorth start, EastNorth end) { 105 118 this(Collections.singleton(p), end.getX()-start.getX(), end.getY()-start.getY()); … … 223 236 return nodes; 224 237 } 238 239 @Override 240 public int hashCode() { 241 final int prime = 31; 242 int result = super.hashCode(); 243 long temp; 244 temp = Double.doubleToLongBits(backupX); 245 result = prime * result + (int) (temp ^ (temp >>> 32)); 246 temp = Double.doubleToLongBits(backupY); 247 result = prime * result + (int) (temp ^ (temp >>> 32)); 248 result = prime * result + ((nodes == null) ? 0 : nodes.hashCode()); 249 result = prime * result + ((oldState == null) ? 0 : oldState.hashCode()); 250 result = prime * result + ((startEN == null) ? 0 : startEN.hashCode()); 251 temp = Double.doubleToLongBits(x); 252 result = prime * result + (int) (temp ^ (temp >>> 32)); 253 temp = Double.doubleToLongBits(y); 254 result = prime * result + (int) (temp ^ (temp >>> 32)); 255 return result; 256 } 257 258 @Override 259 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 MoveCommand other = (MoveCommand) obj; 267 if (Double.doubleToLongBits(backupX) != Double.doubleToLongBits(other.backupX)) 268 return false; 269 if (Double.doubleToLongBits(backupY) != Double.doubleToLongBits(other.backupY)) 270 return false; 271 if (nodes == null) { 272 if (other.nodes != null) 273 return false; 274 } else if (!nodes.equals(other.nodes)) 275 return false; 276 if (oldState == null) { 277 if (other.oldState != null) 278 return false; 279 } else if (!oldState.equals(other.oldState)) 280 return false; 281 if (startEN == null) { 282 if (other.startEN != null) 283 return false; 284 } else if (!startEN.equals(other.startEN)) 285 return false; 286 if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) 287 return false; 288 if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y)) 289 return false; 290 return true; 291 } 225 292 }
Note:
See TracChangeset
for help on using the changeset viewer.