Changeset 1690 in josm for trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
- Timestamp:
- 2009-06-23T22:03:37+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r1530 r1690 43 43 public void putError(String text, Boolean isError) 44 44 { 45 if(errors == null) 45 if(errors == null) { 46 46 errors = new ArrayList<String>(); 47 } 47 48 String s = isError ? tr("Error: {0}", text) : tr("Warning: {0}", text); 48 49 errors.add(s); … … 91 92 * Visibility status as specified by the server. The visible attribute was 92 93 * introduced with the 0.4 API to be able to communicate deleted objects 93 * (they will have visible=false). Currently JOSM does never deal with 94 * these, so this is really for future use only. 94 * (they will have visible=false). 95 95 */ 96 96 public boolean visible = true; … … 195 195 @Override public boolean equals(Object obj) { 196 196 if (id == 0) return obj == this; 197 if (obj instanceof OsmPrimitive) { // not null too197 if (obj instanceof OsmPrimitive) 198 198 return ((OsmPrimitive)obj).id == id && obj.getClass() == getClass(); 199 }200 199 return false; 201 200 } … … 226 225 */ 227 226 public final void put(String key, String value) { 228 if (value == null) 227 if (value == null) { 229 228 remove(key); 230 else { 231 if (keys == null) 229 } else { 230 if (keys == null) { 232 231 keys = new HashMap<String, String>(); 232 } 233 233 keys.put(key, value); 234 234 } … … 241 241 if (keys != null) { 242 242 keys.remove(key); 243 if (keys.isEmpty()) 243 if (keys.isEmpty()) { 244 244 keys = null; 245 } 245 246 } 246 247 mappaintStyle = null; … … 280 281 version = osm.version; 281 282 incomplete = osm.incomplete; 283 visible = osm.visible; 282 284 clearCached(); 283 285 clearErrors(); … … 288 290 * but for the whole object (for conflict resolving) 289 291 * @param semanticOnly if <code>true</code>, modified flag and timestamp are not compared 290 */ 292 * 293 * @deprecated 294 * @see #hasEqualSemanticAttributes(OsmPrimitive) 295 * @see #hasEqualTechnicalAttributes(OsmPrimitive) 296 */ 297 @Deprecated 291 298 public boolean realEqual(OsmPrimitive osm, boolean semanticOnly) { 292 299 return id == osm.id 293 300 && incomplete == osm.incomplete 294 301 && deleted == osm.deleted 295 && (semanticOnly || (modified == osm.modified 296 && timestamp == osm.timestamp 297 && version == osm.version 298 && visible == osm.visible 299 && (user == null ? osm.user==null : user==osm.user))) 302 && (semanticOnly || ( 303 modified == osm.modified 304 && timestamp == osm.timestamp 305 && version == osm.version 306 && visible == osm.visible 307 && (user == null ? osm.user==null : user==osm.user)) 308 ) 300 309 && (keys == null ? osm.keys==null : keys.equals(osm.keys)); 310 } 311 312 /** 313 * Replies true if this primitive and other are equal with respect to their 314 * semantic attributes. 315 * <ol> 316 * <li>equal id</ol> 317 * <li>both are complete or both are incomplete</li> 318 * <li>both have the same tags</li> 319 * </ol> 320 * @param other 321 * @return true if this primitive and other are equal with respect to their 322 * semantic attributes. 323 */ 324 public boolean hasEqualSemanticAttributes(OsmPrimitive other) { 325 if (id != other.id) 326 return false; 327 if (incomplete && ! other.incomplete || !incomplete && other.incomplete) 328 return false; 329 return (keys == null ? other.keys==null : keys.equals(other.keys)); 330 } 331 332 /** 333 * Replies true if this primitive and other are equal with respect to their 334 * technical attributes. The attributes: 335 * <ol> 336 * <li>deleted</ol> 337 * <li>modified</ol> 338 * <li>timestamp</ol> 339 * <li>version</ol> 340 * <li>visible</ol> 341 * <li>user</ol> 342 * </ol> 343 * have to be equal 344 * @param other the other primitive 345 * @return true if this primitive and other are equal with respect to their 346 * technical attributes 347 */ 348 public boolean hasEqualTechnicalAttributes(OsmPrimitive other) { 349 if (other == null) return false; 350 351 return 352 deleted == other.deleted 353 && modified == other.modified 354 && timestamp == other.timestamp 355 && version == other.version 356 && visible == other.visible 357 && (user == null ? other.user==null : user==other.user); 301 358 } 302 359 … … 312 369 if (keys != null) { 313 370 for (Entry<String,String> e : keys.entrySet()) { 314 if (!uninteresting.contains(e.getKey())) {371 if (!uninteresting.contains(e.getKey())) 315 372 return true; 316 }317 373 } 318 374 } … … 327 383 if (keys != null) { 328 384 for (Entry<String,String> e : keys.entrySet()) { 329 if (directionKeys.contains(e.getKey())) {385 if (directionKeys.contains(e.getKey())) 330 386 return true; 331 }332 387 } 333 388 }
Note:
See TracChangeset
for help on using the changeset viewer.
