Class Note
- java.lang.Object
-
- org.openstreetmap.josm.data.notes.Note
-
public class Note extends java.lang.Object
A map note. It always has at least one comment since a comment is required to create a note on osm.org.- Since:
- 7451
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNote.StateNote state
-
Field Summary
Fields Modifier and Type Field Description private java.time.InstantclosedAtprivate java.util.List<NoteComment>commentsprivate java.time.InstantcreatedAtstatic java.util.Comparator<Note>DATE_COMPARATORSorts notes strictly by creation datestatic java.util.Comparator<Note>DEFAULT_COMPARATORSorts notes in the following order: Open notes Closed notes New notes Within each subgroup it sorts by IDprivate longidstatic java.util.Comparator<Note>LAST_ACTION_COMPARATORSorts notes by the last modified dateprivate LatLonlatLonprivate Note.Statestatestatic java.util.Comparator<Note>USER_COMPARATORSorts notes by user, then creation date
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComment(NoteComment comment)Adds a comment.booleanequals(java.lang.Object obj)java.time.InstantgetClosedAt()Returns the date at which this note was closed.java.util.List<NoteComment>getComments()Returns the list of comments associated with this note.java.time.InstantgetCreatedAt()Returns the date at which this note was submitted.NoteCommentgetFirstComment()Returns the comment that was submitted by the user when creating the notelonggetId()Returns the unique OSM ID of this note.NoteCommentgetLastComment()Returns the last comment, ornull.LatLongetLatLon()Returns the geographic location of the note.Note.StategetState()Returns the open or closed state of this note.private java.lang.StringgetUserName()inthashCode()voidsetClosedAt(java.time.Instant closedAt)Sets date at which this note has been closed.voidsetCreatedAt(java.time.Instant createdAt)Sets date at which this note has been created.voidsetId(long id)Sets note id.voidsetState(Note.State state)Sets the note state.java.lang.StringtoString()voidupdateWith(Note note)Copies values from a new note into an existing one.
-
-
-
Field Detail
-
DEFAULT_COMPARATOR
public static final java.util.Comparator<Note> DEFAULT_COMPARATOR
Sorts notes in the following order:- Open notes
- Closed notes
- New notes
-
DATE_COMPARATOR
public static final java.util.Comparator<Note> DATE_COMPARATOR
Sorts notes strictly by creation date
-
USER_COMPARATOR
public static final java.util.Comparator<Note> USER_COMPARATOR
Sorts notes by user, then creation date
-
LAST_ACTION_COMPARATOR
public static final java.util.Comparator<Note> LAST_ACTION_COMPARATOR
Sorts notes by the last modified date
-
id
private long id
-
createdAt
private java.time.Instant createdAt
-
closedAt
private java.time.Instant closedAt
-
state
private Note.State state
-
comments
private java.util.List<NoteComment> comments
-
-
Method Detail
-
getId
public long getId()
Returns the unique OSM ID of this note.- Returns:
- The unique OSM ID of this note
-
setId
public void setId(long id)
Sets note id.- Parameters:
id- OSM ID of this note
-
getLatLon
public LatLon getLatLon()
Returns the geographic location of the note.- Returns:
- The geographic location of the note
-
getCreatedAt
public java.time.Instant getCreatedAt()
Returns the date at which this note was submitted.- Returns:
- Date that this note was submitted
-
setCreatedAt
public void setCreatedAt(java.time.Instant createdAt)
Sets date at which this note has been created.- Parameters:
createdAt- date at which this note has been created
-
getClosedAt
public java.time.Instant getClosedAt()
Returns the date at which this note was closed.- Returns:
- Date that this note was closed. Null if it is still open.
-
setClosedAt
public void setClosedAt(java.time.Instant closedAt)
Sets date at which this note has been closed.- Parameters:
closedAt- date at which this note has been closed
-
getState
public Note.State getState()
Returns the open or closed state of this note.- Returns:
- The open or closed state of this note
-
setState
public void setState(Note.State state)
Sets the note state.- Parameters:
state- note state (open or closed)
-
getComments
public java.util.List<NoteComment> getComments()
Returns the list of comments associated with this note.- Returns:
- An ordered list of comments associated with this note
-
getLastComment
@Nullable public NoteComment getLastComment()
Returns the last comment, ornull.- Returns:
- the last comment, or
null - Since:
- 11821
-
addComment
public void addComment(NoteComment comment)
Adds a comment.- Parameters:
comment- note comment
-
getFirstComment
@Nullable public NoteComment getFirstComment()
Returns the comment that was submitted by the user when creating the note- Returns:
- First comment object
-
getUserName
@Nullable private java.lang.String getUserName()
-
updateWith
public void updateWith(Note note)
Copies values from a new note into an existing one. Used after a note has been updated on the server and the local copy needs refreshing.- Parameters:
note- New values to copy
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-