Class UnambiguousAnnotationComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.annotation.AnnotationComparator
-
- psidev.psi.mi.jami.utils.comparator.annotation.UnambiguousAnnotationComparator
-
- All Implemented Interfaces:
Comparator<Annotation>
public class UnambiguousAnnotationComparator extends AnnotationComparator
Strict annotation comparator It compares first the topics and then the value (case insensitive) - Two annotations which are null are equals - The annotation which is not null is before null. - use UnambiguousCvTermComparator 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 Summary
Constructors Constructor Description UnambiguousAnnotationComparator()Creates a new AnnotationComparator with UnambiguousCvTermComparator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanareEquals(Annotation annotation1, Annotation annotation2)Use UnambiguousAnnotationComparator to know if two annotations are equals.intcompare(Annotation annotation1, Annotation annotation2)It compares first the topics and then the value (case insensitive) - Two annotations which are null are equals - The annotation which is not null is before null.UnambiguousCvTermComparatorgetTopicComparator()Getter for the fieldtopicComparator.static inthashCode(Annotation annot)hashCode-
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
-
getTopicComparator
public UnambiguousCvTermComparator getTopicComparator()
Getter for the field
topicComparator.- Overrides:
getTopicComparatorin classAnnotationComparator- Returns:
- a
Comparatorobject.
-
compare
public int compare(Annotation annotation1, Annotation annotation2)
It compares first the topics and then the value (case insensitive) - Two annotations which are null are equals - The annotation which is not null is before null. - use UnambiguousCvTermComparator 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:
comparein interfaceComparator<Annotation>- Overrides:
comparein classAnnotationComparator- Parameters:
annotation1- aAnnotationobject.annotation2- aAnnotationobject.- Returns:
- a int.
-
areEquals
public static boolean areEquals(Annotation annotation1, Annotation annotation2)
Use UnambiguousAnnotationComparator to know if two annotations are equals.- Parameters:
annotation1- aAnnotationobject.annotation2- aAnnotationobject.- Returns:
- true if the two annotations are equal
-
hashCode
public static int hashCode(Annotation annot)
hashCode
- Parameters:
annot- aAnnotationobject.- Returns:
- the hashcode consistent with the equals method for this comparator
-
-