---
core-dave/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java | 21 ++++++---- 1 file changed, 13 insertions(+), 8 deletions(-) diff -puN src/org/openstreetmap/josm/data/osm/OsmPrimitive.java~osmprim src/org/openstreetmap/josm/data/osm/OsmPrimitive.java --- core/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java~osmprim 2008-05-03 12:08:38.000000000 -0700 +++ core-dave/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java 2008-05-03 12:08:38.000000000 -0700 @@ -154,15 +154,20 @@ abstract public class OsmPrimitive imple } /** - * Equal, if the id (and class) is equal. If both ids are 0, use the super classes - * equal instead. - * - * An primitive is equal to its incomplete counter part. + * Equal, if the id (and class) is equal. + * + * Note: an primitive is equal to its incomplete counterpart. */ @Override public final boolean equals(Object obj) { - if (obj == null || getClass() != obj.getClass() || id == 0 || ((OsmPrimitive)obj).id == 0) - return super.equals(obj); - return id == ((OsmPrimitive)obj).id; + // Unassigned id, only equal if exact same object + if (id == 0) + return obj == this; + if (obj == null) + return false; + // Never equal to different types + if (this.getClass() != obj.getClass()) + return false; + return ((OsmPrimitive)obj).id == id; } /** @@ -259,7 +264,7 @@ abstract public class OsmPrimitive imple (semanticOnly || (visible == osm.visible)) && (keys == null ? osm.keys==null : keys.equals(osm.keys)); } - + public String getTimeStr() { return timestamp == null ? null : new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timestamp); } _ _______________________________________________ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev