Changeset 5440 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2012-08-13T02:37:03+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm/history
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java
r5346 r5440 15 15 */ 16 16 public class HistoryNode extends HistoryOsmPrimitive { 17 17 18 /** the coordinates. May be null for deleted nodes */ 18 19 19 private LatLon coords; 20 20 21 public HistoryNode(long id, long version, boolean visible, User user, long changesetId, Date timestamp, LatLon coords) { 22 super(id, version, visible, user, changesetId, timestamp); 21 /** 22 * Constructs a new {@code HistoryNode}. 23 * 24 * @param id the id (> 0 required) 25 * @param version the version (> 0 required) 26 * @param visible whether the node is still visible 27 * @param user the user (! null required) 28 * @param changesetId the changeset id (> 0 required) 29 * @param timestamp the timestamp (! null required) 30 * @param coords the coordinates 31 * @throws IllegalArgumentException if preconditions are violated 32 */ 33 public HistoryNode(long id, long version, boolean visible, User user, long changesetId, Date timestamp, LatLon coords) throws IllegalArgumentException { 34 this(id, version, visible, user, changesetId, timestamp, coords, true); 35 } 36 37 /** 38 * Constructs a new {@code HistoryNode} with a configurable checking of historic parameters. 39 * This is needed to build virtual HistoryNodes for modified nodes, which do not have a timestamp and a changeset id. 40 * 41 * @param id the id (> 0 required) 42 * @param version the version (> 0 required) 43 * @param visible whether the node is still visible 44 * @param user the user (! null required) 45 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 46 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 47 * @param coords the coordinates 48 * @param checkHistoricParams if true, checks values of {@code changesetId} and {@code timestamp} 49 * @throws IllegalArgumentException if preconditions are violated 50 * @since 5440 51 */ 52 public HistoryNode(long id, long version, boolean visible, User user, long changesetId, Date timestamp, LatLon coords, boolean checkHistoricParams) throws IllegalArgumentException { 53 super(id, version, visible, user, changesetId, timestamp, checkHistoricParams); 23 54 setCoords(coords); 24 55 } 25 56 26 public HistoryNode(Node p) { 27 super(p); 28 setCoords(p.getCoor()); 57 /** 58 * Constructs a new {@code HistoryNode} from an existing {@link Node}. 59 * @param n the node 60 */ 61 public HistoryNode(Node n) { 62 super(n); 63 setCoords(n.getCoor()); 29 64 } 30 65 … … 34 69 } 35 70 71 /** 72 * Replies the coordinates. May be null. 73 * @return the coordinates. May be null. 74 */ 36 75 public LatLon getCoords() { 37 76 return coords; 38 77 } 39 78 79 /** 80 * Sets the coordinates. Can be null. 81 * @param coords the coordinates. Can be null. 82 */ 40 83 public void setCoords(LatLon coords) { 41 84 this.coords = coords; -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r5339 r5440 42 42 43 43 /** 44 * constructor45 * 46 * @param id the id (> 0 required)44 * Constructs a new {@code HistoryOsmPrimitive}. 45 * 46 * @param id the id (> 0 required) 47 47 * @param version the version (> 0 required) 48 48 * @param visible whether the primitive is still visible 49 * @param user the user (! null required) 50 * @param uid the user id (> 0 required) 51 * @param changesetId the changeset id (may be null if the changeset isn't known) 49 * @param user the user (! null required) 50 * @param changesetId the changeset id (> 0 required) 52 51 * @param timestamp the timestamp (! null required) 53 52 * 54 * @throws IllegalArgumentException thrownif preconditions are violated53 * @throws IllegalArgumentException if preconditions are violated 55 54 */ 56 55 public HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, Date timestamp) throws IllegalArgumentException { 56 this(id, version, visible, user, changesetId, timestamp, true); 57 } 58 59 /** 60 * Constructs a new {@code HistoryOsmPrimitive} with a configurable checking of historic parameters. 61 * This is needed to build virtual HistoryOsmPrimitives for modified primitives, which do not have a timestamp and a changeset id. 62 * 63 * @param id the id (> 0 required) 64 * @param version the version (> 0 required) 65 * @param visible whether the primitive is still visible 66 * @param user the user (! null required) 67 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 68 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 69 * @param checkHistoricParams if true, checks values of {@code changesetId} and {@code timestamp} 70 * 71 * @throws IllegalArgumentException if preconditions are violated 72 * @since 5440 73 */ 74 public HistoryOsmPrimitive(long id, long version, boolean visible, User user, long changesetId, Date timestamp, boolean checkHistoricParams) throws IllegalArgumentException { 57 75 ensurePositiveLong(id, "id"); 58 76 ensurePositiveLong(version, "version"); 59 77 CheckParameterUtil.ensureParameterNotNull(user, "user"); 60 CheckParameterUtil.ensureParameterNotNull(timestamp, "timestamp"); 78 if (checkHistoricParams) { 79 ensurePositiveLong(changesetId, "changesetId"); 80 CheckParameterUtil.ensureParameterNotNull(timestamp, "timestamp"); 81 } 61 82 this.id = id; 62 83 this.version = version; 63 84 this.visible = visible; 64 85 this.user = user; 65 // FIXME: restrict to IDs > 0 as soon as OsmPrimitive holds the66 // changeset id too67 86 this.changesetId = changesetId; 68 87 this.timestamp = timestamp; 69 88 tags = new HashMap<String, String>(); 70 89 } 71 90 91 /** 92 * Constructs a new {@code HistoryOsmPrimitive} from an existing {@link OsmPrimitive}. 93 * @param p the primitive 94 */ 72 95 public HistoryOsmPrimitive(OsmPrimitive p) { 73 this(p.getId(), p.getVersion(), p.isVisible(), 74 p.getUser(), 75 p.getChangesetId(), p.getTimestamp()); 76 } 77 96 this(p.getId(), p.getVersion(), p.isVisible(), p.getUser(), p.getChangesetId(), p.getTimestamp()); 97 } 98 99 /** 100 * Replies a new {@link HistoryNode}, {@link HistoryWay} or {@link HistoryRelation} from an existing {@link OsmPrimitive}. 101 * @param p the primitive 102 * @return a new {@code HistoryNode}, {@code HistoryWay} or {@code HistoryRelation} from {@code p}. 103 */ 78 104 public static HistoryOsmPrimitive forOsmPrimitive(OsmPrimitive p) { 79 105 if (p instanceof Node) { … … 173 199 /** 174 200 * Replies the display name of a primitive formatted by <code>formatter</code> 201 * @param formatter The formatter used to generate a display name 175 202 * 176 203 * @return the display name -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java
r5266 r5440 30 30 * @param visible whether the primitive is still visible 31 31 * @param user the user (! null required) 32 * @param uid the user id (> 0 required)33 32 * @param changesetId the changeset id (> 0 required) 34 33 * @param timestamp the timestamp (! null required) 35 34 * 36 * @throws IllegalArgumentException thrownif preconditions are violated35 * @throws IllegalArgumentException if preconditions are violated 37 36 */ 38 public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, 39 Date timestamp) throws IllegalArgumentException { 37 public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, Date timestamp) throws IllegalArgumentException { 40 38 super(id, version, visible, user, changesetId, timestamp); 41 39 } 40 42 41 /** 43 42 * constructor … … 47 46 * @param visible whether the primitive is still visible 48 47 * @param user the user (! null required) 49 * @param uid the user id (> 0 required) 48 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 49 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 50 * @param checkHistoricParams If true, checks values of {@code changesetId} and {@code timestamp} 51 * 52 * @throws IllegalArgumentException if preconditions are violated 53 * @since 5440 54 */ 55 public HistoryRelation(long id, long version, boolean visible, User user, long changesetId, Date timestamp, boolean checkHistoricParams) throws IllegalArgumentException { 56 super(id, version, visible, user, changesetId, timestamp, checkHistoricParams); 57 } 58 59 /** 60 * constructor 61 * 62 * @param id the id (>0 required) 63 * @param version the version (> 0 required) 64 * @param visible whether the primitive is still visible 65 * @param user the user (! null required) 50 66 * @param changesetId the changeset id (> 0 required) 51 67 * @param timestamp the timestamp (! null required) … … 62 78 } 63 79 64 public HistoryRelation(Relation p) { 65 super(p); 80 /** 81 * Constructs a new {@code HistoryRelation} from an existing {@link Relation}. 82 * @param r the relation 83 */ 84 public HistoryRelation(Relation r) { 85 super(r); 66 86 } 67 87 -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java
r5266 r5440 12 12 import org.openstreetmap.josm.data.osm.User; 13 13 import org.openstreetmap.josm.data.osm.Way; 14 import org.openstreetmap.josm.tools.CheckParameterUtil; 14 15 15 16 /** … … 22 23 private ArrayList<Long> nodeIds = new ArrayList<Long>(); 23 24 24 public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp) { 25 /** 26 * Constructs a new {@code HistoryWay}. 27 * 28 * @param id the id (> 0 required) 29 * @param version the version (> 0 required) 30 * @param visible whether the node is still visible 31 * @param user the user (! null required) 32 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 33 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 34 * @throws IllegalArgumentException if preconditions are violated 35 */ 36 public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp) throws IllegalArgumentException { 25 37 super(id, version, visible, user, changesetId, timestamp); 26 38 } 27 39 28 public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp, ArrayList<Long> nodeIdList) { 40 /** 41 * Constructs a new {@code HistoryWay} with a configurable checking of historic parameters. 42 * This is needed to build virtual HistoryWays for modified ways, which do not have a timestamp and a changeset id. 43 * 44 * @param id the id (> 0 required) 45 * @param version the version (> 0 required) 46 * @param visible whether the node is still visible 47 * @param user the user (! null required) 48 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 49 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 50 * @param checkHistoricParams if true, checks values of {@code changesetId} and {@code timestamp} 51 * @throws IllegalArgumentException if preconditions are violated 52 * @since 5440 53 */ 54 public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp, boolean checkHistoricParams) throws IllegalArgumentException { 55 super(id, version, visible, user, changesetId, timestamp, checkHistoricParams); 56 } 57 58 /** 59 * Constructs a new {@code HistoryWay} with a given list of node ids. 60 * 61 * @param id the id (> 0 required) 62 * @param version the version (> 0 required) 63 * @param visible whether the node is still visible 64 * @param user the user (! null required) 65 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true) 66 * @param timestamp the timestamp (! null required if {@code checkHistoricParams} is true) 67 * @param nodeIdList the node ids (! null required) 68 * @throws IllegalArgumentException if preconditions are violated 69 */ 70 public HistoryWay(long id, long version, boolean visible, User user, long changesetId, Date timestamp, ArrayList<Long> nodeIdList) throws IllegalArgumentException { 29 71 this(id, version, visible, user, changesetId, timestamp); 72 CheckParameterUtil.ensureParameterNotNull(nodeIdList, "nodeIdList"); 30 73 this.nodeIds.addAll(nodeIdList); 31 74 } 32 75 33 public HistoryWay(Way p) { 34 super(p); 76 /** 77 * Constructs a new {@code HistoryWay} from an existing {@link Way}. 78 * @param w the way 79 */ 80 public HistoryWay(Way w) { 81 super(w); 35 82 } 36 83
Note:
See TracChangeset
for help on using the changeset viewer.