// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.data.conflict; import java.util.Map; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.PrimitiveId; /** * Represents a conflict between two {@link OsmPrimitive}s. It is represented as * a pair of {@link OsmPrimitive}s where one element of the pair has the role my * and the other has the role their. *
my
is the {@link OsmPrimitive} in the local datasettheir
is the {@link OsmPrimitive} which caused the conflict when it
* it was tried to merge it onto my
. their
is usually the
* {@link OsmPrimitive} from the dataset in another layer or the one retrieved from the server.primitive
is participating
* in this conflict
*
* @param primitive the primitive
* @return true if the primitive primitive
is participating
* in this conflict
*/
public boolean isParticipating(OsmPrimitive primitive) {
if (primitive == null) return false;
return primitive.getPrimitiveId().equals(my.getPrimitiveId())
|| primitive.getPrimitiveId().equals(their.getPrimitiveId());
}
/**
* Replies true if the primitive with id id
is participating
* in this conflict
*
* @param id the primitive id
* @return true if the primitive primitive
is participating
* in this conflict
*/
public boolean isParticipating(PrimitiveId id) {
if (id == null) return false;
return id.equals(my.getPrimitiveId())
|| id.equals(their.getPrimitiveId());
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((my == null) ? 0 : my.hashCode());
result = prime * result + ((their == null) ? 0 : their.hashCode());
return result;
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Conflict