Package org.biojavax

Class 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 Detail

      • SimpleComment

        public SimpleComment​(java.lang.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​(java.lang.String comment)
      • getComment

        public java.lang.String getComment()
        Returns the comment part of this comment.
        Specified by:
        getComment in interface Comment
        Returns:
        a comment.
      • getRank

        public int getRank()
        Returns the rank of this comment.
        Specified by:
        getRank in interface Comment
        Returns:
        the rank.
      • equals

        public boolean equals​(java.lang.Object obj)
        Two comments are defined as equal if their text values and rankings are identical.
        Overrides:
        equals in class java.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:
        compareTo in interface java.lang.Comparable
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Form: "(#rank) comment"
        Overrides:
        toString in class java.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.