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 int
changesCount
the number of changes for this changesetprivate java.time.Instant
closedAt
the date this changeset was closed atprivate int
commentsCount
the number of comments for this changesetprivate ChangesetDataSet
content
the changeset contentprivate java.time.Instant
createdAt
date this changeset was created atprivate java.util.List<ChangesetDiscussionComment>
discussion
the changeset discussionprivate int
id
the changeset idprivate boolean
incomplete
indicates whether this changeset is incomplete.private LatLon
max
the max.static int
MAX_CHANGESET_TAG_LENGTH
The maximum changeset tag length allowed by API 0.6private LatLon
min
the min.private boolean
open
indicates whether this changeset is still open or notprivate java.util.Map<java.lang.String,java.lang.String>
tags
the map of tagsprivate User
user
the 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 void
addDiscussionComment(ChangesetDiscussionComment comment)
Adds a comment to the changeset discussion.int
compareTo(Changeset other)
Compares this changeset to another, based on their identifier.boolean
equals(java.lang.Object obj)
static Changeset
fromPrimitive(OsmPrimitive primitive)
Creates a changeset with the data obtained from the given preset, i.e., thechangeset id
,user
, andtimestamp
.java.lang.String
get(java.lang.String key)
Replies the value of the given key; null, if there is no value for this keyBounds
getBounds()
Returns the changeset bounding box.int
getChangesCount()
Replies the number of changes for this changeset.java.time.Instant
getClosedAt()
Returns the changeset closure date.java.lang.String
getComment()
Replies this changeset comment.int
getCommentsCount()
Replies the number of comments for this changeset discussion.ChangesetDataSet
getContent()
Returns the changeset contents.java.time.Instant
getCreatedAt()
Returns the changeset creation date.java.util.List<ChangesetDiscussionComment>
getDiscussion()
Replies the list of comments in the changeset discussion, if any.java.lang.String
getDisplayName(NameFormatter formatter)
Returns the changeset display name, as per given name formatter.int
getId()
Returns the changeset identifier.java.util.Map<java.lang.String,java.lang.String>
getKeys()
Replies the map of key/value pairs.LatLon
getMax()
Returns the max lat/lon of the changeset bounding box.LatLon
getMin()
Returns the min lat/lon of the changeset bounding box.java.lang.String
getName()
Returns the changeset name.int
getNumKeys()
Gets the number of keysUser
getUser()
Returns the changeset user.boolean
hasContent()
Determines if this changeset has contents.boolean
hasEqualSemanticAttributes(Changeset other)
Determines if this changeset has equals semantic attributes with another one.int
hashCode()
boolean
hasKeys()
Replies true, if there is at least one key/value pair; false, otherwiseboolean
isIncomplete()
Determines if this changeset is incomplete.boolean
isNew()
Determines if this changeset is new.boolean
isOpen()
Determines if this changeset is open.java.util.Collection<java.lang.String>
keySet()
Replies the set of keysvoid
mergeFrom(Changeset other)
Merges changeset metadata from another changeset.void
put(java.lang.String key, java.lang.String value)
Sets a key/value pairsvoid
remove(java.lang.String key)
Removes a given key/value pairvoid
removeAll()
Removes all tagsvoid
setChangesCount(int changesCount)
Sets the number of changes for this changeset.void
setClosedAt(java.time.Instant closedAt)
Sets the changeset closure date.void
setCommentsCount(int commentsCount)
Sets the number of comments for this changeset discussion.void
setContent(ChangesetDataSet content)
Sets the changeset contents.void
setCreatedAt(java.time.Instant createdAt)
Sets the changeset creation date.void
setId(int id)
Sets the changeset identifier.void
setIncomplete(boolean incomplete)
Sets whether this changeset is incompletevoid
setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
Sets the map of key/value pairsvoid
setMax(LatLon max)
Sets the max lat/lon of the changeset bounding box.void
setMin(LatLon min)
Sets the min lat/lon of the changeset bounding box.void
setOpen(boolean open)
Sets whether this changeset is open.void
setUser(User user)
Sets the changeset user.java.lang.String
toString()
-
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:
compareTo
in interfacejava.lang.Comparable<Changeset>
- Parameters:
other
- other changeset- Returns:
- the value
0
ifgetId() == other.getId()
; a value less than0
ifgetId() < other.getId()
; and a value greater than0
ifgetId() > 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:
true
if this changeset is open
-
setOpen
public void setOpen(boolean open)
Sets whether this changeset is open.- Parameters:
open
-true
if 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:Tagged
Replies 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:Tagged
Sets the map of key/value pairs
-
isIncomplete
public boolean isIncomplete()
Determines if this changeset is incomplete.- Returns:
true
if this changeset is incomplete
-
setIncomplete
public void setIncomplete(boolean incomplete)
Sets whether this changeset is incomplete- Parameters:
incomplete
-true
if this changeset is incomplete
-
put
public void put(java.lang.String key, java.lang.String value)
Description copied from interface:Tagged
Sets a key/value pairs
-
get
public java.lang.String get(java.lang.String key)
Description copied from interface:Tagged
Replies 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:Tagged
Removes 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:
true
if this changeset has equals semantic attributes with other changeset
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hasKeys
public boolean hasKeys()
Description copied from interface:Tagged
Replies 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:Tagged
Replies the set of keys- Specified by:
keySet
in interfaceTagged
- Returns:
- the set of keys
- See Also:
Tagged.keys()
-
getNumKeys
public int getNumKeys()
Description copied from interface:Tagged
Gets the number of keys- Specified by:
getNumKeys
in interfaceTagged
- Returns:
- The number of keys set for this tagged object.
-
isNew
public boolean isNew()
Determines if this changeset is new.- Returns:
true
if 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:
true
if 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:
toString
in classjava.lang.Object
-
-