Package org.biojavax

Class SimpleNote

  • All Implemented Interfaces:
    java.lang.Comparable, Changeable, Note

    public class SimpleNote
    extends AbstractChangeable
    implements Note
    Simple implementation of Note.
    Since:
    1.5
    Author:
    Richard Holland, George Waldon - limited firing
    • Constructor Detail

      • SimpleNote

        public SimpleNote​(ComparableTerm term,
                          java.lang.String value,
                          int rank)
        Creates a new instance of SimpleNote with a given term, value and rank.
        Parameters:
        term - the term of the note. Cannot be null.
        value - the (optional) value to give it.
        rank - the rank to give it.
      • SimpleNote

        protected SimpleNote()
    • Method Detail

      • getTerm

        public ComparableTerm getTerm()
        Gets the term that defines this note.
        Specified by:
        getTerm in interface Note
        Returns:
        a ComparableTerm object that is the key to this note.
      • getValue

        public java.lang.String getValue()
        Gets the value that defines this note.
        Specified by:
        getValue in interface Note
        Returns:
        a String object that is the value to this note.
      • setValue

        public void setValue​(java.lang.String value)
                      throws ChangeVetoException
        Sets the value for this note, or null for no value.
        Specified by:
        setValue in interface Note
        Parameters:
        value - the value to use.
        Throws:
        ChangeVetoException - if it doesn't like the value.
      • getRank

        public int getRank()
        Gets the rank that defines this note.
        Specified by:
        getRank in interface Note
        Returns:
        an int that is the rank to this note.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Notes are compared first by rank, then by the term.
        Specified by:
        compareTo in interface java.lang.Comparable
      • equals

        public boolean equals​(java.lang.Object o)
        Notes are equal if they have the same rank and term.
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Form: "(#rank) term: value"
        Overrides:
        toString in class java.lang.Object