Class ExactExternalIdentifierComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.xref.UnambiguousExternalIdentifierComparator
-
- psidev.psi.mi.jami.utils.comparator.xref.ExactExternalIdentifierComparator
-
- All Implemented Interfaces:
Comparator<Xref>
public class ExactExternalIdentifierComparator extends UnambiguousExternalIdentifierComparator
Exact comparator for external identifiers (Xref database and id). It compares first the databases using UnambiguousCvTermComparator, then the ids (case sensitive) and then the version. To compare the databases, it looks first at the PSI-MI ids if at least one of the database has a PSI-MI id, otherwise it looks at the database shortlabel only. - Two external identifiers which are null are equals - The external identifier which is not null is before null. - If the two external identifiers are set : - compare the databases. If both databases are equal, compare the ids (is case sensitive) - if both ids are the same, compares the versions.- Since:
20/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description ExactExternalIdentifierComparator()
Constructor for ExactExternalIdentifierComparator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
areEquals(Xref externalIdentifier1, Xref externalIdentifier2)
Use ExactExternalIdentifierComparator to know if two external identifiers are equals.int
compare(Xref externalIdentifier1, Xref externalIdentifier2)
It compares first the databases using UnambiguousCvTermComparator, then the ids (case sensitive) and then the version.static int
hashCode(Xref externalIdentifier1)
-
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
-
compare
public int compare(Xref externalIdentifier1, Xref externalIdentifier2)
It compares first the databases using UnambiguousCvTermComparator, then the ids (case sensitive) and then the version. To compare the databases, it looks first at the PSI-MI ids if at least one of the database has a PSI-MI id, otherwise it looks at the database shortlabel only. - Two external identifiers which are null are equals - The external identifier which is not null is before null. - If the two external identifiers are set : - compare the databases. If both databases are equal, compare the ids (is case sensitive) - if both ids are the same, compares the versions.- Specified by:
compare
in interfaceComparator<Xref>
- Overrides:
compare
in classUnambiguousExternalIdentifierComparator
- Parameters:
externalIdentifier1
- aXref
object.externalIdentifier2
- aXref
object.- Returns:
- a int.
-
areEquals
public static boolean areEquals(Xref externalIdentifier1, Xref externalIdentifier2)
Use ExactExternalIdentifierComparator to know if two external identifiers are equals.
-
hashCode
public static int hashCode(Xref externalIdentifier1)
-
-