Changeset 2448 in josm for trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
- Timestamp:
- 2009-11-14T17:59:10+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r2242 r2448 10 10 11 11 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 12 import org.openstreetmap.josm.data.osm.PrimitiveId; 13 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 12 14 13 15 /** … … 45 47 * @param user the user (! null required) 46 48 * @param uid the user id (> 0 required) 47 * @param changesetId the changeset id ( > 0 required)49 * @param changesetId the changeset id (may be null if the changeset isn't known) 48 50 * @param timestamp the timestamp (! null required) 49 51 * … … 53 55 ensurePositiveLong(id, "id"); 54 56 ensurePositiveLong(version, "version"); 55 if(uid != -1) /* allow -1 for anonymous users */57 if(uid != -1) { 56 58 ensurePositiveLong(uid, "uid"); 57 ensurePositiveLong(changesetId, "changesetId");59 } 58 60 ensureNotNull(user, "user"); 59 61 ensureNotNull(timestamp, "timestamp"); … … 63 65 this.user = user; 64 66 this.uid = uid; 67 // FIXME: restrict to IDs > 0 as soon as OsmPrimitive holds the 68 // changeset id too 65 69 this.changesetId = changesetId; 66 70 this.timestamp = timestamp; … … 71 75 return id; 72 76 } 77 78 public PrimitiveId getPrimitiveId() { 79 return new SimplePrimitiveId(id, getType()); 80 } 81 73 82 public boolean isVisible() { 74 83 return visible; … … 103 112 public int compareTo(HistoryOsmPrimitive o) { 104 113 if (this.id != o.id) 105 throw new ClassCastException(tr("Can' t compare primitive with ID ''{0}'' to primitive with ID ''{1}''.", o.id, this.id));114 throw new ClassCastException(tr("Can''t compare primitive with ID ''{0}'' to primitive with ID ''{1}''.", o.id, this.id)); 106 115 return new Long(this.version).compareTo(o.version); 107 116 } … … 121 130 public Map<String,String> getTags() { 122 131 return Collections.unmodifiableMap(tags); 132 } 133 134 /** 135 * Sets the tags for this history primitive. Removes all 136 * tags if <code>tags</code> is null. 137 * 138 * @param tags the tags. May be null. 139 */ 140 public void setTags(Map<String,String> tags) { 141 if (tags == null) { 142 this.tags = new HashMap<String, String>(); 143 } else { 144 this.tags = new HashMap<String, String>(tags); 145 } 123 146 } 124 147
Note:
See TracChangeset
for help on using the changeset viewer.