Class PublicationComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.publication.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 Summary
Constructors Constructor Description PublicationComparator(Comparator<Xref> identifierComparator)
Constructor for PublicationComparator.PublicationComparator(CollectionComparator<Xref> identifiersComparator)
Constructor for PublicationComparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Publication publication1, Publication publication2)
It will first compare IMEx identifiers (publication with IMEx will always come first).CollectionComparator<Xref>
getIdentifierCollectionComparator()
Getter for the fieldidentifierCollectionComparator
.Comparator<Xref>
getIdentifierComparator()
Getter for the fieldidentifierComparator
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
PublicationComparator
public PublicationComparator(Comparator<Xref> identifierComparator)
Constructor for PublicationComparator.
- Parameters:
identifierComparator
- aComparator
object.
-
PublicationComparator
public PublicationComparator(CollectionComparator<Xref> identifiersComparator)
Constructor for PublicationComparator.
- Parameters:
identifiersComparator
- aCollectionComparator
object.
-
-
Method Detail
-
getIdentifierComparator
public Comparator<Xref> getIdentifierComparator()
Getter for the field
identifierComparator
.- Returns:
- a
Comparator
object.
-
getIdentifierCollectionComparator
public CollectionComparator<Xref> getIdentifierCollectionComparator()
Getter for the field
identifierCollectionComparator
.- Returns:
- a
CollectionComparator
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 interfaceComparator<Publication>
- Parameters:
publication1
- aPublication
object.publication2
- aPublication
object.- Returns:
- a int.
-
-