Package org.biojavax
Class SimpleComment
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.SimpleComment
-
- All Implemented Interfaces:
java.lang.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 protectedSimpleComment()SimpleComment(java.lang.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 intcompareTo(java.lang.Object o)Comments are ordered first by their rank, then by a string comparison of their text values.booleanequals(java.lang.Object obj)Two comments are defined as equal if their text values and rankings are identical.java.lang.StringgetComment()Returns the comment part of this comment.java.lang.IntegergetId()Gets the Hibernate ID.intgetRank()Returns the rank of this comment.inthashCode()protected voidsetComment(java.lang.String comment)voidsetId(java.lang.Integer id)Sets the Hibernate ID.voidsetRank(int rank)Sets the rank of this comment.java.lang.StringtoString()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
-
-
-
-
Method Detail
-
setComment
protected void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
Returns the comment part of this comment.- Specified by:
getCommentin interfaceComment- Returns:
- a comment.
-
setRank
public void setRank(int rank) throws ChangeVetoExceptionSets the rank of this comment.- Specified by:
setRankin 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(java.lang.Object obj)
Two comments are defined as equal if their text values and rankings are identical.- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
Comments are ordered first by their rank, then by a string comparison of their text values.- Specified by:
compareToin interfacejava.lang.Comparable
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Form: "(#rank) comment"- Overrides:
toStringin classjava.lang.Object
-
getId
public java.lang.Integer getId()
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
setId
public void setId(java.lang.Integer id)
Sets the Hibernate ID. Should be used with caution.- Parameters:
id- the Hibernate ID, if using Hibernate.
-
-