Class Changeset

  • All Implemented Interfaces:
    java.lang.Comparable<Changeset>, Tagged

    public final class Changeset
    extends java.lang.Object
    implements Tagged, java.lang.Comparable<Changeset>
    Represents a single changeset in JOSM. For now its only used during upload but in the future we may do more.
    Since:
    625
    • Field Detail

      • id

        private int id
        the changeset id
      • user

        private User user
        the user who owns the changeset
      • 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
      • min

        private LatLon min
        the min. coordinates of the bounding box of this changeset
      • max

        private LatLon max
        the max. coordinates of the bounding box of this changeset
      • 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
    • Constructor Detail

      • Changeset

        public Changeset()
        Creates a new changeset with id 0.
      • Changeset

        public Changeset​(int id)
        Creates a changeset with id id. If id > 0, sets incomplete to true.
        Parameters:
        id - the id
      • Changeset

        public Changeset​(Changeset other)
        Creates a clone of other
        Parameters:
        other - the other changeset. If null, creates a new changeset with id 0.
    • Method Detail

      • compareTo

        public int compareTo​(Changeset other)
        Compares this changeset to another, based on their identifier.
        Specified by:
        compareTo in interface java.lang.Comparable<Changeset>
        Parameters:
        other - other changeset
        Returns:
        the value 0 if getId() == other.getId(); a value less than 0 if getId() < other.getId(); and a value greater than 0 if getId() > 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
      • getUser

        public User getUser()
        Returns the changeset user.
        Returns:
        the changeset user
      • setUser

        public void setUser​(User user)
        Sets the changeset user.
        Parameters:
        user - changeset user
      • 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.
        Specified by:
        getKeys in interface Tagged
        Returns:
        the map of key/value pairs
      • 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
        Specified by:
        setKeys in interface Tagged
        Parameters:
        keys - the map of key value pairs. If null, reset to the empty map.
      • 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
        Specified by:
        put in interface Tagged
        Parameters:
        key - the key
        value - the value. If null, removes the key/value pair.
      • 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
        Specified by:
        get in interface Tagged
        Parameters:
        key - the key
        Returns:
        the value
      • remove

        public void remove​(java.lang.String key)
        Description copied from interface: Tagged
        Removes a given key/value pair
        Specified by:
        remove in interface Tagged
        Parameters:
        key - the key
      • 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 class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hasKeys

        public boolean hasKeys()
        Description copied from interface: Tagged
        Replies true, if there is at least one key/value pair; false, otherwise
        Specified by:
        hasKeys in interface Tagged
        Returns:
        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 interface Tagged
        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 interface Tagged
        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
      • setContent

        public void setContent​(ChangesetDataSet content)
        Sets the changeset contents.
        Parameters:
        content - changeset contents, can be null
      • getDiscussion

        public java.util.List<ChangesetDiscussionCommentgetDiscussion()
        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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object