Changeset 2604 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2009-12-10T18:42:41+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r2598 r2604 17 17 public final class Changeset implements Tagged { 18 18 /** the changeset id */ 19 private longid;19 private int id; 20 20 /** the user who owns the changeset */ 21 21 private User user; … … 50 50 * @param id the id 51 51 */ 52 public Changeset( longid) {52 public Changeset(int id) { 53 53 this.id = id; 54 54 this.incomplete = id > 0; … … 90 90 91 91 public int compareTo(Changeset other) { 92 return Long.valueOf(getId()).compareTo(other.getId());92 return Integer.valueOf(getId()).compareTo(other.getId()); 93 93 } 94 94 … … 102 102 } 103 103 104 public longgetId() {104 public int getId() { 105 105 return id; 106 106 } 107 107 108 public void setId( longid) {108 public void setId(int id) { 109 109 this.id = id; 110 110 } … … 234 234 final int prime = 31; 235 235 int result = 1; 236 result = prime * result + (i nt) (id ^ (id >>> 32));236 result = prime * result + (id ^ (id >>> 32)); 237 237 if (id > 0) 238 238 return prime * result + getClass().hashCode(); … … 306 306 return id <= 0; 307 307 } 308 309 public void mergeFrom(Changeset other) { 310 if (other == null) 311 return; 312 if (id != other.id) 313 return; 314 this.user = other.user; 315 this.createdAt = other.createdAt; 316 this.closedAt = other.closedAt; 317 this.open = other.open; 318 this.min = other.min; 319 this.max = other.max; 320 this.tags.clear(); 321 this.tags.putAll(other.tags); 322 } 308 323 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2603 r2604 238 238 239 239 /** 240 * The id of the changeset this primitive was last uploaded to. 241 * 0 if it wasn't uploaded to a changeset yet of if the changeset 242 * id isn't known. 243 */ 244 private int changesetId; 245 246 /** 240 247 * Creates a new primitive for the given id. If the id > 0, the primitive is marked 241 248 * as incomplete. … … 577 584 public void setUser(User user) { 578 585 this.user = user; 586 } 587 588 589 /** 590 * Replies the id of the changeset this primitive was last uploaded to. 591 * 0 if this primitive wasn't uploaded to a changeset yet or if the 592 * changeset isn't known. 593 * 594 * @return the id of the changeset this primitive was last uploaded to. 595 */ 596 public int getChangesetId() { 597 return changesetId; 598 } 599 600 601 /** 602 * Sets the changeset id of this primitive. Can't be set on a new 603 * primitive. 604 * 605 * @param changesetId the id. >= 0 required. 606 * @throws IllegalStateException thrown if this primitive is new. 607 * @throws IllegalArgumentException thrown if id < 0 608 */ 609 public void setChangesetId(int changesetId) throws IllegalStateException, IllegalArgumentException { 610 if (changesetId < 0) 611 throw new IllegalArgumentException(tr("Parameter ''{0}'' >= 0 expected, got {1}", "changesetId", changesetId)); 612 if (isNew() && changesetId > 0) 613 throw new IllegalStateException(tr("Can''t assign a changesetId > 0 to a new primitive. Value of changesetId is {0}", changesetId)); 614 this.changesetId = changesetId; 579 615 } 580 616 … … 916 952 * use this only in the data initializing phase 917 953 */ 918 public void cloneFrom(OsmPrimitive osm) { 919 setKeys(osm.getKeys()); 920 id = osm.id; 921 timestamp = osm.timestamp; 922 version = osm.version; 923 setIncomplete(osm.isIncomplete()); 924 flags = osm.flags; 925 user= osm.user; 954 public void cloneFrom(OsmPrimitive other) { 955 setKeys(other.getKeys()); 956 id = other.id; 957 timestamp = other.timestamp; 958 version = other.version; 959 setIncomplete(other.isIncomplete()); 960 flags = other.flags; 961 user= other.user; 962 changesetId = other.changesetId; 926 963 clearCached(); 927 964 } … … 951 988 flags = other.flags; 952 989 user= other.user; 990 changesetId = other.changesetId; 953 991 } 954 992 … … 1000 1038 && version == other.version 1001 1039 && isVisible() == other.isVisible() 1002 && (user == null ? other.user==null : user==other.user); 1040 && (user == null ? other.user==null : user==other.user) 1041 && changesetId == other.changesetId; 1003 1042 } 1004 1043 … … 1098 1137 timestamp = data.getTimestamp(); 1099 1138 user = data.getUser(); 1139 changesetId = data.getChangesetId(); 1100 1140 setDeleted(data.isDeleted()); 1101 1141 setModified(data.isModified()); … … 1118 1158 data.setModified(isModified()); 1119 1159 data.setVisible(isVisible()); 1160 data.setChangesetId(changesetId); 1120 1161 } 1121 1162 -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
r2598 r2604 46 46 private int version; 47 47 private int timestamp; 48 private int changesetId; 48 49 49 50 public boolean isModified() { … … 89 90 this.timestamp = timestamp; 90 91 } 92 93 public int getChangesetId() { 94 return changesetId; 95 } 96 97 public void setChangesetId(int changesetId) { 98 this.changesetId = changesetId; 99 } 100 91 101 public Map<String, String> getKeys() { 92 102 return keys;
Note:
See TracChangeset
for help on using the changeset viewer.