Class ChecksumComparator

  • All Implemented Interfaces:
    Comparator<Checksum>
    Direct Known Subclasses:
    UnambiguousChecksumComparator

    public class ChecksumComparator
    extends Object
    implements Comparator<Checksum>
    Simple comparator for checksum. It will first compares the method using a CvTermComparator 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 DefaultCvTermComparator 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

      • ChecksumComparator

        public ChecksumComparator​(Comparator<CvTerm> termComparator)
        Creates a new ChecksumComparator.
        Parameters:
        termComparator - : comparator for the method which is required
    • Method Detail

      • getMethodComparator

        public Comparator<CvTerm> getMethodComparator()

        Getter for the field methodComparator.

        Returns:
        a Comparator object.
      • compare

        public int compare​(Checksum checksum1,
                           Checksum checksum2)
        It will first compares the method using a CvTermComparator 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 CvTermComparator 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>
        Parameters:
        checksum1 - : the first checksum
        checksum2 - : the second checksum
        Returns:
        the comparison value