Package org.openstreetmap.josm.data.osm
Class Changeset
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.Changeset
-
-
Field Summary
Fields Modifier and Type Field Description private intchangesCountthe number of changes for this changesetprivate java.time.InstantclosedAtthe date this changeset was closed atprivate intcommentsCountthe number of comments for this changesetprivate ChangesetDataSetcontentthe changeset contentprivate java.time.InstantcreatedAtdate this changeset was created atprivate java.util.List<ChangesetDiscussionComment>discussionthe changeset discussionprivate intidthe changeset idprivate booleanincompleteindicates whether this changeset is incomplete.private LatLonmaxthe max.static intMAX_CHANGESET_TAG_LENGTHThe maximum changeset tag length allowed by API 0.6private LatLonminthe min.private booleanopenindicates whether this changeset is still open or notprivate java.util.Map<java.lang.String,java.lang.String>tagsthe map of tagsprivate Useruserthe user who owns the changeset-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDiscussionComment(ChangesetDiscussionComment comment)Adds a comment to the changeset discussion.intcompareTo(Changeset other)Compares this changeset to another, based on their identifier.booleanequals(java.lang.Object obj)static ChangesetfromPrimitive(OsmPrimitive primitive)Creates a changeset with the data obtained from the given preset, i.e., thechangeset id,user, andtimestamp.java.lang.Stringget(java.lang.String key)Replies the value of the given key; null, if there is no value for this keyBoundsgetBounds()Returns the changeset bounding box.intgetChangesCount()Replies the number of changes for this changeset.java.time.InstantgetClosedAt()Returns the changeset closure date.java.lang.StringgetComment()Replies this changeset comment.intgetCommentsCount()Replies the number of comments for this changeset discussion.ChangesetDataSetgetContent()Returns the changeset contents.java.time.InstantgetCreatedAt()Returns the changeset creation date.java.util.List<ChangesetDiscussionComment>getDiscussion()Replies the list of comments in the changeset discussion, if any.java.lang.StringgetDisplayName(NameFormatter formatter)Returns the changeset display name, as per given name formatter.intgetId()Returns the changeset identifier.java.util.Map<java.lang.String,java.lang.String>getKeys()Replies the map of key/value pairs.LatLongetMax()Returns the max lat/lon of the changeset bounding box.LatLongetMin()Returns the min lat/lon of the changeset bounding box.java.lang.StringgetName()Returns the changeset name.intgetNumKeys()Gets the number of keysUsergetUser()Returns the changeset user.booleanhasContent()Determines if this changeset has contents.booleanhasEqualSemanticAttributes(Changeset other)Determines if this changeset has equals semantic attributes with another one.inthashCode()booleanhasKeys()Replies true, if there is at least one key/value pair; false, otherwisebooleanisIncomplete()Determines if this changeset is incomplete.booleanisNew()Determines if this changeset is new.booleanisOpen()Determines if this changeset is open.java.util.Collection<java.lang.String>keySet()Replies the set of keysvoidmergeFrom(Changeset other)Merges changeset metadata from another changeset.voidput(java.lang.String key, java.lang.String value)Sets a key/value pairsvoidremove(java.lang.String key)Removes a given key/value pairvoidremoveAll()Removes all tagsvoidsetChangesCount(int changesCount)Sets the number of changes for this changeset.voidsetClosedAt(java.time.Instant closedAt)Sets the changeset closure date.voidsetCommentsCount(int commentsCount)Sets the number of comments for this changeset discussion.voidsetContent(ChangesetDataSet content)Sets the changeset contents.voidsetCreatedAt(java.time.Instant createdAt)Sets the changeset creation date.voidsetId(int id)Sets the changeset identifier.voidsetIncomplete(boolean incomplete)Sets whether this changeset is incompletevoidsetKeys(java.util.Map<java.lang.String,java.lang.String> keys)Sets the map of key/value pairsvoidsetMax(LatLon max)Sets the max lat/lon of the changeset bounding box.voidsetMin(LatLon min)Sets the min lat/lon of the changeset bounding box.voidsetOpen(boolean open)Sets whether this changeset is open.voidsetUser(User user)Sets the changeset user.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasKey, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keys, put, putAll, visitKeys
-
-
-
-
Field Detail
-
MAX_CHANGESET_TAG_LENGTH
public static final int MAX_CHANGESET_TAG_LENGTH
The maximum changeset tag length allowed by API 0.6- See Also:
- Constant Field Values
-
id
private int id
the changeset id
-
createdAt
private java.time.Instant createdAt
date this changeset was created at
-
closedAt
private java.time.Instant closedAt
the date this changeset was closed at
-
open
private boolean open
indicates whether this changeset is still open or not
-
commentsCount
private int commentsCount
the number of comments for this changeset
-
changesCount
private int changesCount
the number of changes for this changeset
-
tags
private java.util.Map<java.lang.String,java.lang.String> tags
the map of tags
-
incomplete
private boolean incomplete
indicates whether this changeset is incomplete. For an incomplete changeset we only know its id
-
content
private ChangesetDataSet content
the changeset content
-
discussion
private java.util.List<ChangesetDiscussionComment> discussion
the changeset discussion
-
-
Method Detail
-
fromPrimitive
public static Changeset fromPrimitive(OsmPrimitive primitive)
Creates a changeset with the data obtained from the given preset, i.e., thechangeset id,user, andtimestamp.- Parameters:
primitive- the primitive to use- Returns:
- the created changeset
-
compareTo
public int compareTo(Changeset other)
Compares this changeset to another, based on their identifier.- Specified by:
compareToin interfacejava.lang.Comparable<Changeset>- Parameters:
other- other changeset- Returns:
- the value
0ifgetId() == other.getId(); a value less than0ifgetId() < other.getId(); and a value greater than0ifgetId() > other.getId()
-
getName
public java.lang.String getName()
Returns the changeset name.- Returns:
- the changeset name (untranslated: "changeset <identifier>")
-
getDisplayName
public java.lang.String getDisplayName(NameFormatter formatter)
Returns the changeset display name, as per given name formatter.- Parameters:
formatter- name formatter- Returns:
- the changeset display name, as per given name formatter
-
getId
public int getId()
Returns the changeset identifier.- Returns:
- the changeset identifier
-
setId
public void setId(int id)
Sets the changeset identifier.- Parameters:
id- changeset identifier
-
getCreatedAt
public java.time.Instant getCreatedAt()
Returns the changeset creation date.- Returns:
- the changeset creation date
-
setCreatedAt
public void setCreatedAt(java.time.Instant createdAt)
Sets the changeset creation date.- Parameters:
createdAt- changeset creation date
-
getClosedAt
public java.time.Instant getClosedAt()
Returns the changeset closure date.- Returns:
- the changeset closure date
-
setClosedAt
public void setClosedAt(java.time.Instant closedAt)
Sets the changeset closure date.- Parameters:
closedAt- changeset closure date
-
isOpen
public boolean isOpen()
Determines if this changeset is open.- Returns:
trueif this changeset is open
-
setOpen
public void setOpen(boolean open)
Sets whether this changeset is open.- Parameters:
open-trueif this changeset is open
-
getMin
public LatLon getMin()
Returns the min lat/lon of the changeset bounding box.- Returns:
- the min lat/lon of the changeset bounding box
-
setMin
public void setMin(LatLon min)
Sets the min lat/lon of the changeset bounding box.- Parameters:
min- min lat/lon of the changeset bounding box
-
getMax
public LatLon getMax()
Returns the max lat/lon of the changeset bounding box.- Returns:
- the max lat/lon of the changeset bounding box
-
setMax
public void setMax(LatLon max)
Sets the max lat/lon of the changeset bounding box.- Parameters:
max- min lat/lon of the changeset bounding box
-
getBounds
public Bounds getBounds()
Returns the changeset bounding box.- Returns:
- the changeset bounding box
-
getComment
public java.lang.String getComment()
Replies this changeset comment.- Returns:
- this changeset comment (empty string if missing)
- Since:
- 12494
-
getCommentsCount
public int getCommentsCount()
Replies the number of comments for this changeset discussion.- Returns:
- the number of comments for this changeset discussion
- Since:
- 7700
-
setCommentsCount
public void setCommentsCount(int commentsCount)
Sets the number of comments for this changeset discussion.- Parameters:
commentsCount- the number of comments for this changeset discussion- Since:
- 7700
-
getChangesCount
public int getChangesCount()
Replies the number of changes for this changeset.- Returns:
- the number of changes for this changeset
- Since:
- 14231
-
setChangesCount
public void setChangesCount(int changesCount)
Sets the number of changes for this changeset.- Parameters:
changesCount- the number of changes for this changeset- Since:
- 14231
-
getKeys
public java.util.Map<java.lang.String,java.lang.String> getKeys()
Description copied from interface:TaggedReplies the map of key/value pairs. Never null, but may be the empty map.
-
setKeys
public void setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
Description copied from interface:TaggedSets the map of key/value pairs
-
isIncomplete
public boolean isIncomplete()
Determines if this changeset is incomplete.- Returns:
trueif this changeset is incomplete
-
setIncomplete
public void setIncomplete(boolean incomplete)
Sets whether this changeset is incomplete- Parameters:
incomplete-trueif this changeset is incomplete
-
put
public void put(java.lang.String key, java.lang.String value)
Description copied from interface:TaggedSets a key/value pairs
-
get
public java.lang.String get(java.lang.String key)
Description copied from interface:TaggedReplies the value of the given key; null, if there is no value for this key
-
remove
public void remove(java.lang.String key)
Description copied from interface:TaggedRemoves a given key/value pair
-
hasEqualSemanticAttributes
public boolean hasEqualSemanticAttributes(Changeset other)
Determines if this changeset has equals semantic attributes with another one.- Parameters:
other- other changeset- Returns:
trueif this changeset has equals semantic attributes with other changeset
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hasKeys
public boolean hasKeys()
Description copied from interface:TaggedReplies true, if there is at least one key/value pair; false, otherwise
-
keySet
public java.util.Collection<java.lang.String> keySet()
Description copied from interface:TaggedReplies the set of keys- Specified by:
keySetin interfaceTagged- Returns:
- the set of keys
- See Also:
Tagged.keys()
-
getNumKeys
public int getNumKeys()
Description copied from interface:TaggedGets the number of keys- Specified by:
getNumKeysin interfaceTagged- Returns:
- The number of keys set for this tagged object.
-
isNew
public boolean isNew()
Determines if this changeset is new.- Returns:
trueif this changeset is new (id <= 0)
-
mergeFrom
public void mergeFrom(Changeset other)
Merges changeset metadata from another changeset.- Parameters:
other- other changeset
-
hasContent
public boolean hasContent()
Determines if this changeset has contents.- Returns:
trueif this changeset has contents
-
getContent
public ChangesetDataSet getContent()
Returns the changeset contents.- Returns:
- the changeset contents, can be null
-
setContent
public void setContent(ChangesetDataSet content)
Sets the changeset contents.- Parameters:
content- changeset contents, can be null
-
getDiscussion
public java.util.List<ChangesetDiscussionComment> getDiscussion()
Replies the list of comments in the changeset discussion, if any.- Returns:
- the list of comments in the changeset discussion. May be empty but never null
- Since:
- 7704
-
addDiscussionComment
public void addDiscussionComment(ChangesetDiscussionComment comment)
Adds a comment to the changeset discussion.- Parameters:
comment- the comment to add. Ignored if null- Since:
- 7704
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-