Class PublicationComparator

  • All Implemented Interfaces:
    Comparator<Publication>
    Direct Known Subclasses:
    UnambiguousPublicationComparator

    public class PublicationComparator
    extends Object
    implements Comparator<Publication>
    publication comparator. It will first compare IMEx identifiers (publication with IMEx will always come first). If both IMEx identifiers are not, it will only compare the identifiers (pubmed, then doi, then all identifiers) using UnambiguousExternalIdentifierComparator (publications with identifiers will always come first). If both publication identifiers are not set, it will look at first publication title (case insensitive), then the authors (order is taken into account), then the journal (case insensitive) and finally the publication date. - Two publications which are null are equals - The publication which is not null is before null.
    Since:
    21/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • PublicationComparator

        public PublicationComparator​(Comparator<Xref> identifierComparator)

        Constructor for PublicationComparator.

        Parameters:
        identifierComparator - a Comparator object.
    • Method Detail

      • getIdentifierComparator

        public Comparator<Xref> getIdentifierComparator()

        Getter for the field identifierComparator.

        Returns:
        a Comparator object.
      • compare

        public int compare​(Publication publication1,
                           Publication publication2)
        It will first compare IMEx identifiers (publication with IMEx will always come first). If both IMEx identifiers are not, it will only compare the identifiers (pubmed, then doi, then all identifiers) using UnambiguousExternalIdentifierComparator (publications with identifiers will always come first). If both publication identifiers are not set, it will look at first publication title (case insensitive), then the authors (order is taken into account), then the journal (case insensitive) and finally the publication date. - Two publications which are null are equals - The publication which is not null is before null.
        Specified by:
        compare in interface Comparator<Publication>
        Parameters:
        publication1 - a Publication object.
        publication2 - a Publication object.
        Returns:
        a int.