Changeset 9460 in josm
- Timestamp:
- 2016-01-15T03:12:34+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r9267 r9460 145 145 } 146 146 147 /**148 * Replies the version number as returned by the API. The version is 0 if the id is 0 or149 * if this primitive is incomplete.150 *151 * @see PrimitiveData#setVersion(int)152 */153 147 @Override 154 148 public int getVersion() { … … 156 150 } 157 151 158 /**159 * Replies the id of this primitive.160 *161 * @return the id of this primitive.162 */163 152 @Override 164 153 public long getId() { … … 178 167 179 168 /** 180 * 181 * @return True ifprimitive is new (not yet uploaded the server, id <= 0)169 * Determines if this primitive is new. 170 * @return {@code true} if this primitive is new (not yet uploaded the server, id <= 0) 182 171 */ 183 172 @Override … … 186 175 } 187 176 188 /**189 *190 * @return True if primitive is new or undeleted191 * @see #isNew()192 * @see #isUndeleted()193 */194 177 @Override 195 178 public boolean isNewOrUndeleted() { … … 197 180 } 198 181 199 /**200 * Sets the id and the version of this primitive if it is known to the OSM API.201 *202 * Since we know the id and its version it can't be incomplete anymore. incomplete203 * is set to false.204 *205 * @param id the id. > 0 required206 * @param version the version > 0 required207 * @throws IllegalArgumentException if id <= 0208 * @throws IllegalArgumentException if version <= 0209 * @throws DataIntegrityProblemException if id is changed and primitive was already added to the dataset210 */211 182 @Override 212 183 public void setOsmId(long id, int version) { … … 239 210 } 240 211 241 /**242 * Replies the user who has last touched this object. May be null.243 *244 * @return the user who has last touched this object. May be null.245 */246 212 @Override 247 213 public User getUser() { … … 249 215 } 250 216 251 /**252 * Sets the user who has last touched this object.253 *254 * @param user the user255 */256 217 @Override 257 218 public void setUser(User user) { … … 259 220 } 260 221 261 /**262 * Replies the id of the changeset this primitive was last uploaded to.263 * 0 if this primitive wasn't uploaded to a changeset yet or if the264 * changeset isn't known.265 *266 * @return the id of the changeset this primitive was last uploaded to.267 */268 222 @Override 269 223 public int getChangesetId() { … … 271 225 } 272 226 273 /**274 * Sets the changeset id of this primitive. Can't be set on a new275 * primitive.276 *277 * @param changesetId the id. >= 0 required.278 * @throws IllegalStateException if this primitive is new.279 * @throws IllegalArgumentException if id < 0280 */281 227 @Override 282 228 public void setChangesetId(int changesetId) { … … 291 237 } 292 238 293 /**294 * Replies the unique primitive id for this primitive295 *296 * @return the unique primitive id for this primitive297 */298 239 @Override 299 240 public PrimitiveId getPrimitiveId() { … … 315 256 } 316 257 317 /**318 * Time of last modification to this object. This is not set by JOSM but319 * read from the server and delivered back to the server unmodified. It is320 * used to check against edit conflicts.321 *322 * @return date of last modification323 */324 258 @Override 325 259 public Date getTimestamp() { … … 349 283 } 350 284 351 /**352 * Marks this primitive as being modified.353 *354 * @param modified true, if this primitive is to be modified355 */356 285 @Override 357 286 public void setModified(boolean modified) { … … 359 288 } 360 289 361 /**362 * Replies <code>true</code> if the object has been modified since it was loaded from363 * the server. In this case, on next upload, this object will be updated.364 *365 * Deleted objects are deleted from the server. If the objects are added (id=0),366 * the modified is ignored and the object is added to the server.367 *368 * @return <code>true</code> if the object has been modified since it was loaded from369 * the server370 */371 290 @Override 372 291 public boolean isModified() { … … 374 293 } 375 294 376 /**377 * Replies <code>true</code>, if the object has been deleted.378 *379 * @return <code>true</code>, if the object has been deleted.380 * @see #setDeleted(boolean)381 */382 295 @Override 383 296 public boolean isDeleted() { … … 385 298 } 386 299 387 /** 388 * Replies <code>true</code> if the object has been deleted on the server and was undeleted by the user. 389 * @return <code>true</code> if the object has been undeleted 390 */ 300 @Override 391 301 public boolean isUndeleted() { 392 302 return (flags & (FLAG_VISIBLE + FLAG_DELETED)) == 0; 393 303 } 394 304 395 /** 396 * Replies <code>true</code>, if the object is usable 397 * (i.e. complete and not deleted). 398 * 399 * @return <code>true</code>, if the object is usable. 400 * @see #setDeleted(boolean) 401 */ 305 @Override 402 306 public boolean isUsable() { 403 307 return (flags & (FLAG_DELETED + FLAG_INCOMPLETE)) == 0; 404 308 } 405 309 406 /**407 * Checks if object is known to the server.408 * Replies true if this primitive is either unknown to the server (i.e. its id409 * is 0) or it is known to the server and it hasn't be deleted on the server.410 * Replies false, if this primitive is known on the server and has been deleted411 * on the server.412 *413 * @return <code>true</code>, if the object is visible on server.414 * @see #setVisible(boolean)415 */416 310 @Override 417 311 public boolean isVisible() { … … 419 313 } 420 314 421 /**422 * Sets whether this primitive is visible, i.e. whether it is known on the server423 * and not deleted on the server.424 *425 * @see #isVisible()426 * @throws IllegalStateException if visible is set to false on an primitive with id==0427 */428 315 @Override 429 316 public void setVisible(boolean visible) { … … 433 320 } 434 321 435 /**436 * Sets whether this primitive is deleted or not.437 *438 * Also marks this primitive as modified if deleted is true.439 *440 * @param deleted true, if this primitive is deleted; false, otherwise441 */442 322 @Override 443 323 public void setDeleted(boolean deleted) { … … 774 654 protected abstract void keysChangedImpl(Map<String, String> originalKeys); 775 655 776 /**777 * Replies the name of this primitive. The default implementation replies the value778 * of the tag <tt>name</tt> or null, if this tag is not present.779 *780 * @return the name of this primitive781 */782 656 @Override 783 657 public String getName() { … … 785 659 } 786 660 787 /**788 * Replies a localized name for this primitive given by the value of the name tags789 * accessed from very specific (language variant) to more generic (default name).790 *791 * @see LanguageInfo#getLanguageCodes792 * @return the name of this primitive, <code>null</code> if no name exists793 */794 661 @Override 795 662 public String getLocalName() { -
trunk/src/org/openstreetmap/josm/data/osm/INode.java
r8510 r9460 5 5 import org.openstreetmap.josm.data.coor.LatLon; 6 6 7 /** 8 * INode captures the common functions of {@link Node} and {@link NodeData}. 9 * @since 4098 10 */ 7 11 public interface INode extends IPrimitive { 8 12 13 /** 14 * Returns lat/lon coordinates of this node. 15 * @return lat/lon coordinates of this node 16 */ 9 17 LatLon getCoor(); 10 18 19 /** 20 * Sets lat/lon coordinates of this node. 21 * @param coor lat/lon coordinates of this node 22 */ 11 23 void setCoor(LatLon coor); 12 24 25 /** 26 * Returns east/north coordinates of this node. 27 * @return east/north coordinates of this node 28 */ 13 29 EastNorth getEastNorth(); 14 30 31 /** 32 * Sets east/north coordinates of this node. 33 * @param eastNorth east/north coordinates of this node 34 */ 15 35 void setEastNorth(EastNorth eastNorth); 16 36 } -
trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java
r8565 r9460 5 5 6 6 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 7 import org.openstreetmap.josm.tools.LanguageInfo; 7 8 8 9 /** 9 10 * IPrimitive captures the common functions of {@link OsmPrimitive} and {@link PrimitiveData}. 11 * @since 4098 10 12 */ 11 13 public interface IPrimitive extends Tagged, PrimitiveId { 12 14 15 /** 16 * Replies <code>true</code> if the object has been modified since it was loaded from 17 * the server. In this case, on next upload, this object will be updated. 18 * 19 * Deleted objects are deleted from the server. If the objects are added (id=0), 20 * the modified is ignored and the object is added to the server. 21 * 22 * @return <code>true</code> if the object has been modified since it was loaded from 23 * the server 24 */ 13 25 boolean isModified(); 14 26 27 /** 28 * Marks this primitive as being modified. 29 * 30 * @param modified true, if this primitive is to be modified 31 */ 15 32 void setModified(boolean modified); 16 33 34 /** 35 * Checks if object is known to the server. 36 * Replies true if this primitive is either unknown to the server (i.e. its id 37 * is 0) or it is known to the server and it hasn't be deleted on the server. 38 * Replies false, if this primitive is known on the server and has been deleted 39 * on the server. 40 * 41 * @return <code>true</code>, if the object is visible on server. 42 * @see #setVisible(boolean) 43 */ 17 44 boolean isVisible(); 18 45 46 /** 47 * Sets whether this primitive is visible, i.e. whether it is known on the server 48 * and not deleted on the server. 49 * @param visible {@code true} if this primitive is visible 50 * 51 * @throws IllegalStateException if visible is set to false on an primitive with id==0 52 * @see #isVisible() 53 */ 19 54 void setVisible(boolean visible); 20 55 56 /** 57 * Replies <code>true</code>, if the object has been deleted. 58 * 59 * @return <code>true</code>, if the object has been deleted. 60 * @see #setDeleted(boolean) 61 */ 21 62 boolean isDeleted(); 22 63 64 /** 65 * Sets whether this primitive is deleted or not. 66 * 67 * Also marks this primitive as modified if deleted is true. 68 * 69 * @param deleted true, if this primitive is deleted; false, otherwise 70 */ 23 71 void setDeleted(boolean deleted); 24 72 73 /** 74 * Determines if this primitive is incomplete. 75 * @return {@code true} if this primitive is incomplete, {@code false} otherwise 76 */ 25 77 boolean isIncomplete(); 26 78 79 /** 80 * Replies <code>true</code> if the object has been deleted on the server and was undeleted by the user. 81 * @return <code>true</code> if the object has been undeleted 82 */ 83 boolean isUndeleted(); 84 85 /** 86 * Replies <code>true</code>, if the object is usable 87 * (i.e. complete and not deleted). 88 * 89 * @return <code>true</code>, if the object is usable. 90 * @see #setDeleted(boolean) 91 */ 92 boolean isUsable(); 93 94 /** 95 * Determines if this primitive is new or undeleted. 96 * @return True if primitive is new or undeleted 97 * @see #isNew() 98 * @see #isUndeleted() 99 */ 27 100 boolean isNewOrUndeleted(); 28 101 102 /** 103 * Replies the id of this primitive. 104 * 105 * @return the id of this primitive. 106 */ 29 107 long getId(); 30 108 109 /** 110 * Replies the unique primitive id for this primitive 111 * 112 * @return the unique primitive id for this primitive 113 */ 31 114 PrimitiveId getPrimitiveId(); 32 115 116 /** 117 * Replies the version number as returned by the API. The version is 0 if the id is 0 or 118 * if this primitive is incomplete. 119 * @return the version number as returned by the API 120 * 121 * @see PrimitiveData#setVersion(int) 122 */ 33 123 int getVersion(); 34 124 125 /** 126 * Sets the id and the version of this primitive if it is known to the OSM API. 127 * 128 * Since we know the id and its version it can't be incomplete anymore. incomplete 129 * is set to false. 130 * 131 * @param id the id. > 0 required 132 * @param version the version > 0 required 133 * @throws IllegalArgumentException if id <= 0 134 * @throws IllegalArgumentException if version <= 0 135 * @throws DataIntegrityProblemException if id is changed and primitive was already added to the dataset 136 */ 35 137 void setOsmId(long id, int version); 36 138 139 /** 140 * Replies the user who has last touched this object. May be null. 141 * 142 * @return the user who has last touched this object. May be null. 143 */ 37 144 User getUser(); 38 145 146 /** 147 * Sets the user who has last touched this object. 148 * 149 * @param user the user 150 */ 39 151 void setUser(User user); 40 152 153 /** 154 * Time of last modification to this object. This is not set by JOSM but 155 * read from the server and delivered back to the server unmodified. It is 156 * used to check against edit conflicts. 157 * 158 * @return date of last modification 159 * @see #setTimestamp 160 */ 41 161 Date getTimestamp(); 42 162 163 /** 164 * Time of last modification to this object. This is not set by JOSM but 165 * read from the server and delivered back to the server unmodified. It is 166 * used to check against edit conflicts. 167 * 168 * @return last modification as timestamp 169 * @see #setRawTimestamp 170 */ 43 171 int getRawTimestamp(); 44 172 173 /** 174 * Sets time of last modification to this object 175 * @param timestamp date of last modification 176 * @see #getTimestamp 177 */ 45 178 void setTimestamp(Date timestamp); 46 179 180 /** 181 * Sets time of last modification to this object 182 * @param timestamp date of last modification 183 * @see #getRawTimestamp 184 */ 47 185 void setRawTimestamp(int timestamp); 48 186 187 /** 188 * Determines if this primitive has no timestam information. 189 * @return {@code true} if this primitive has no timestam information 190 * @see #getTimestamp 191 * @see #getRawTimestamp 192 */ 49 193 boolean isTimestampEmpty(); 50 194 195 /** 196 * Replies the id of the changeset this primitive was last uploaded to. 197 * 0 if this primitive wasn't uploaded to a changeset yet or if the 198 * changeset isn't known. 199 * 200 * @return the id of the changeset this primitive was last uploaded to. 201 */ 51 202 int getChangesetId(); 52 203 204 /** 205 * Sets the changeset id of this primitive. Can't be set on a new primitive. 206 * 207 * @param changesetId the id. >= 0 required. 208 * @throws IllegalStateException if this primitive is new. 209 * @throws IllegalArgumentException if id < 0 210 */ 53 211 void setChangesetId(int changesetId); 54 212 213 /** 214 * Makes the given visitor visit this primitive. 215 * @param visitor visitor 216 */ 55 217 void accept(PrimitiveVisitor visitor); 56 218 219 /** 220 * Replies the name of this primitive. The default implementation replies the value 221 * of the tag <tt>name</tt> or null, if this tag is not present. 222 * 223 * @return the name of this primitive 224 */ 57 225 String getName(); 58 226 227 /** 228 * Replies a localized name for this primitive given by the value of the name tags 229 * accessed from very specific (language variant) to more generic (default name). 230 * 231 * @return the name of this primitive, <code>null</code> if no name exists 232 * @see LanguageInfo#getLanguageCodes 233 */ 59 234 String getLocalName(); 60 235 } -
trunk/src/org/openstreetmap/josm/data/osm/IRelation.java
r8510 r9460 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 /** 5 * IRelation captures the common functions of {@link Relation} and {@link RelationData}. 6 * @since 4098 7 */ 4 8 public interface IRelation extends IPrimitive { 5 9 10 /** 11 * Returns the number of members. 12 * @return number of members 13 */ 6 14 int getMembersCount(); 7 15 16 /** 17 * Returns id of the member at given index. 18 * @param idx member index 19 * @return id of the member at given index 20 */ 8 21 long getMemberId(int idx); 9 22 23 /** 24 * Returns role of the member at given index. 25 * @param idx member index 26 * @return role of the member at given index 27 */ 10 28 String getRole(int idx); 11 29 30 /** 31 * Returns type of the member at given index. 32 * @param idx member index 33 * @return type of the member at given index 34 */ 12 35 OsmPrimitiveType getMemberType(int idx); 13 36 } -
trunk/src/org/openstreetmap/josm/data/osm/IWay.java
r8510 r9460 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 /** 5 * IWay captures the common functions of {@link Way} and {@link WayData}. 6 * @since 4098 7 */ 4 8 public interface IWay extends IPrimitive { 5 9 10 /** 11 * Replies the number of nodes in this way. 12 * 13 * @return the number of nodes in this way. 14 */ 6 15 int getNodesCount(); 7 16 17 /** 18 * Returns id of the node at given index. 19 * @param idx node index 20 * @return id of the node at given index 21 */ 8 22 long getNodeId(int idx); 9 23 24 /** 25 * Determines if this way is closed. 26 * @return {@code true} if this way is closed, {@code false} otherwise 27 */ 10 28 boolean isClosed(); 11 29 } -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r9243 r9460 67 67 } 68 68 69 /**70 * @return number of members71 */72 69 @Override 73 70 public int getMembersCount() { -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r9243 r9460 99 99 } 100 100 101 /**102 * Replies the number of nodes in this way.103 *104 * @return the number of nodes in this way.105 * @since 1862106 */107 101 @Override 108 102 public int getNodesCount() {
Note:
See TracChangeset
for help on using the changeset viewer.