| 287 | | * Perform an equality compare for all non-volatile fields not only for the id |
| 288 | | * but for the whole object (for conflict resolving) |
| 289 | | * @param semanticOnly if <code>true</code>, modified flag and timestamp are not compared |
| | 287 | * Compare this OSM primitive with <code>other</code>. Can be invoked in one of two modes: |
| | 288 | * <ul> |
| | 289 | * <li>to compare the values of "semantic" fields only. Replies true, if the fields id, incomplete, deleted and |
| | 290 | * the set of key/value-pairs are equal</li> |
| | 291 | * <li>to compare the values of <em>all</em> fields. Replies true, if the "semantic" fields |
| | 292 | * and in addition the fields modified, timestamp, version, visible and user are equal. |
| | 293 | * </ul> |
| | 294 | * |
| | 295 | * @param semanticOnly if <code>true</code>,compares "semantic" fields only; if <code>false</code>, compares |
| | 296 | * all fields |
| | 297 | * |
| | 298 | * @return true, if this and <code>other</code> are equal; false, otherwise |
| 291 | | public boolean realEqual(OsmPrimitive osm, boolean semanticOnly) { |
| 292 | | return id == osm.id |
| 293 | | && incomplete == osm.incomplete |
| 294 | | && 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))) |
| 300 | | && (keys == null ? osm.keys==null : keys.equals(osm.keys)); |
| | 300 | public boolean realEqual(OsmPrimitive other, boolean semanticOnly) { |
| | 301 | boolean ret = |
| | 302 | id == other.id |
| | 303 | && incomplete == other.incomplete |
| | 304 | && deleted == other.deleted |
| | 305 | && (keys == null ? other.keys==null : keys.equals(other.keys)); |
| | 306 | |
| | 307 | if (semanticOnly) { |
| | 308 | return ret; |
| | 309 | } |
| | 310 | ret = ret |
| | 311 | && modified == other.modified |
| | 312 | && timestamp == other.timestamp |
| | 313 | && version == other.version |
| | 314 | && visible == other.visible |
| | 315 | && (user == null ? other.user==null : user==other.user) |
| | 316 | ; |
| | 317 | return ret; |