Class UnambiguousPublicationComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.publication.PublicationComparator
-
- psidev.psi.mi.jami.utils.comparator.publication.UnambiguousPublicationComparator
-
- All Implemented Interfaces:
Comparator<Publication>
public class UnambiguousPublicationComparator extends PublicationComparator
Unambiguous 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 UnambiguousPublicationComparator()Creates a new UnambiguousPublicationComparator based on UnambiguousExternalIdentifierComparator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanareEquals(Publication pub1, Publication pub2)Use UnambiguousPublicationComparator to know if two publications are equals.UnambiguousExternalIdentifierComparatorgetIdentifierComparator()getIdentifierComparatorstatic inthashCode(Publication pub)hashCode-
Methods inherited from class psidev.psi.mi.jami.utils.comparator.publication.PublicationComparator
compare, getIdentifierCollectionComparator
-
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
-
-
-
-
Method Detail
-
getIdentifierComparator
public UnambiguousExternalIdentifierComparator getIdentifierComparator()
getIdentifierComparator
- Overrides:
getIdentifierComparatorin classPublicationComparator- Returns:
- a
UnambiguousExternalIdentifierComparatorobject.
-
areEquals
public static boolean areEquals(Publication pub1, Publication pub2)
Use UnambiguousPublicationComparator to know if two publications are equals.- Parameters:
pub1- aPublicationobject.pub2- aPublicationobject.- Returns:
- true if the two publications are equal
-
hashCode
public static int hashCode(Publication pub)
hashCode
- Parameters:
pub- aPublicationobject.- Returns:
- the hashcode consistent with the equals method for this comparator
-
-