Package org.biojavax
Class SimpleComment
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.SimpleComment
-
- All Implemented Interfaces:
Comparable
,Changeable
,Comment
public class SimpleComment extends AbstractChangeable implements Comment
An implementaion of Comment.- Since:
- 1.5
- Author:
- Richard Holland, gwaldon
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleComment()
SimpleComment(String comment, int rank)
Constructs a new, immutable comment, given some text and a rank.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
Comments are ordered first by their rank, then by a string comparison of their text values.boolean
equals(Object obj)
Two comments are defined as equal if their text values and rankings are identical.String
getComment()
Returns the comment part of this comment.Integer
getId()
Gets the Hibernate ID.int
getRank()
Returns the rank of this comment.int
hashCode()
protected void
setComment(String comment)
void
setId(Integer id)
Sets the Hibernate ID.void
setRank(int rank)
Sets the rank of this comment.String
toString()
Form: "(#rank) comment"-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Constructor Detail
-
SimpleComment
public SimpleComment(String comment, int rank)
Constructs a new, immutable comment, given some text and a rank.- Parameters:
comment
- the text of the comment. Cannot be null.rank
- the rank of the comment.
-
SimpleComment
protected SimpleComment()
-
-
Method Detail
-
setComment
protected void setComment(String comment)
-
getComment
public String getComment()
Returns the comment part of this comment.- Specified by:
getComment
in interfaceComment
- Returns:
- a comment.
-
setRank
public void setRank(int rank) throws ChangeVetoException
Sets the rank of this comment.- Specified by:
setRank
in interfaceComment
- Parameters:
rank
- the rank to use.- Throws:
ChangeVetoException
- if the new rank is unacceptable.
-
getRank
public int getRank()
Returns the rank of this comment.
-
equals
public boolean equals(Object obj)
Two comments are defined as equal if their text values and rankings are identical.
-
compareTo
public int compareTo(Object o)
Comments are ordered first by their rank, then by a string comparison of their text values.- Specified by:
compareTo
in interfaceComparable
-
getId
public Integer getId()
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
-