Class UnambiguousChecksumComparator

  • All Implemented Interfaces:
    Comparator<Checksum>

    public class UnambiguousChecksumComparator
    extends ChecksumComparator
    Unambiguous checksum comparator. - Two checksum which are null are equals - The checksum which is not null is before null. - use UnambiguousCvTermComparator to compare the methods. If they are equals, compares the values (case sensitive)
    Since:
    18/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • UnambiguousChecksumComparator

        public UnambiguousChecksumComparator()

        Constructor for UnambiguousChecksumComparator.

    • Method Detail

      • compare

        public int compare​(Checksum checksum1,
                           Checksum checksum2)
        It will first compares the method using a UnambiguousCvTermComparator and then it will compare the checksum values - 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<Checksum>
        Overrides:
        compare in class ChecksumComparator
        Parameters:
        checksum1 - a Checksum object.
        checksum2 - a Checksum object.
        Returns:
        a int.
      • areEquals

        public static boolean areEquals​(Checksum checksum1,
                                        Checksum checksum2)
        Use UnambiguousChecksumComparator to know if two checksum are equals.
        Parameters:
        checksum1 - a Checksum object.
        checksum2 - a Checksum object.
        Returns:
        true if the two checksum are equal
      • hashCode

        public static int hashCode​(Checksum checksum)

        hashCode

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