Package org.klomp.snark.comments
Class Comment
java.lang.Object
org.klomp.snark.comments.Comment
- All Implemented Interfaces:
Comparable<Comment>
Store a single comment and/or rating.
Unmodifiable except for marking as hidden.
Stores a one-second timestamp but designed so identical
comments within a certain time frame (bucket) are equal.
Don't store in a plain set - see equals().
- Since:
- 0.9.31
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
reverseboolean
Comments within 10 minutes (not necessarily in same bucket) and otherwise equal are considered equal.boolean
Ignores timestampstatic Comment
int
getID()
A unique ID that may be used to delete this comment from the CommentSet via remove(int).getName()
int
getText()
long
getTime()
java time (ms)int
hashCode()
boolean
isHidden()
boolean
isMine()
(package private) void
-
Field Details
-
MAX_NAME_LEN
public static final int MAX_NAME_LEN- See Also:
-
-
Constructor Details
-
Comment
My comment, now- Parameters:
text
- may be null, will be truncated to max length, newlines replaced with spacesname
- may be null, will be truncated to max length, newlines and commas removedrating
- 0-5
-
Comment
- Parameters:
text
- may be null, will be truncated to max length, newlines replaced with spacesname
- may be null, will be truncated to max length, newlines and commas removedrating
- 0-5time
- java time (ms)
-
-
Method Details
-
getText
-
getName
-
getRating
public int getRating() -
getTime
public long getTime()java time (ms) -
isMine
public boolean isMine() -
isHidden
public boolean isHidden() -
setHidden
void setHidden() -
getID
public int getID()A unique ID that may be used to delete this comment from the CommentSet via remove(int). NOT persisted across restarts. -
compareTo
reverse- Specified by:
compareTo
in interfaceComparable<Comment>
-
toPersistentString
- Returns:
- time,rating,mine,hidden,name,text
-
fromPersistentString
- Returns:
- null if can't be parsed
-
hashCode
public int hashCode() -
equals
Comments within 10 minutes (not necessarily in same bucket) and otherwise equal are considered equal. Violates contract, as equal objects may have different hashcodes and be in adjacent buckets. -
equalsIgnoreTimestamp
Ignores timestamp- Parameters:
c
- non-null
-