Class UnambiguousAnnotationComparator

  • All Implemented Interfaces:
    Comparator<Annotation>

    public class UnambiguousAnnotationComparator
    extends AnnotationComparator
    Strict annotation comparator It compares first the topics and then the value (case insensitive) - Two annotations which are null are equals - The annotation which is not null is before null. - use UnambiguousCvTermComparator to compare the topics. If they are equals, compares the values (case insensitive) - If both annotations have same topic, the one with a null value is always after the one with a non null value.
    Since:
    18/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • UnambiguousAnnotationComparator

        public UnambiguousAnnotationComparator()
        Creates a new AnnotationComparator with UnambiguousCvTermComparator
    • Method Detail

      • compare

        public int compare​(Annotation annotation1,
                           Annotation annotation2)
        It compares first the topics and then the value (case insensitive) - Two annotations which are null are equals - The annotation which is not null is before null. - use UnambiguousCvTermComparator to compare the topics. If they are equals, compares the values (case insensitive) - If both annotations have same topic, the one with a null value is always after the one with a non null value.
        Specified by:
        compare in interface Comparator<Annotation>
        Overrides:
        compare in class AnnotationComparator
        Parameters:
        annotation1 - a Annotation object.
        annotation2 - a Annotation object.
        Returns:
        a int.
      • areEquals

        public static boolean areEquals​(Annotation annotation1,
                                        Annotation annotation2)
        Use UnambiguousAnnotationComparator to know if two annotations are equals.
        Parameters:
        annotation1 - a Annotation object.
        annotation2 - a Annotation object.
        Returns:
        true if the two annotations are equal
      • hashCode

        public static int hashCode​(Annotation annot)

        hashCode

        Parameters:
        annot - a Annotation object.
        Returns:
        the hashcode consistent with the equals method for this comparator