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 boolean
areEquals(Annotation annotation1, Annotation annotation2)
Use UnambiguousAnnotationComparator to know if two annotations are equals.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.UnambiguousCvTermComparator
getTopicComparator()
Getter for the fieldtopicComparator
.static int
hashCode(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:
getTopicComparator
in classAnnotationComparator
- Returns:
- a
Comparator
object.
-
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:
compare
in interfaceComparator<Annotation>
- Overrides:
compare
in classAnnotationComparator
- Parameters:
annotation1
- aAnnotation
object.annotation2
- aAnnotation
object.- Returns:
- a int.
-
areEquals
public static boolean areEquals(Annotation annotation1, Annotation annotation2)
Use UnambiguousAnnotationComparator to know if two annotations are equals.- Parameters:
annotation1
- aAnnotation
object.annotation2
- aAnnotation
object.- Returns:
- true if the two annotations are equal
-
hashCode
public static int hashCode(Annotation annot)
hashCode
- Parameters:
annot
- aAnnotation
object.- Returns:
- the hashcode consistent with the equals method for this comparator
-
-