Class AliasComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.alias.AliasComparator
-
- All Implemented Interfaces:
Comparator<Alias>
- Direct Known Subclasses:
UnambiguousAliasComparator
public class AliasComparator extends Object implements Comparator<Alias>
Simple comparator for aliases. It will first compare alias types and then alias names (case sensitive) - Two aliases which are null are equals - The alias which is not null is before null. - If the alias types are not set, compares the names (case sensitive) - If both alias types are set, use CvTermComparator to compare the alias types. If they are equals, compares the names (case sensitive)- Since:
18/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description AliasComparator(Comparator<CvTerm> typeComparator)
Creates a new AliasComparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Alias alias1, Alias alias2)
It will first compare alias types and then alias names (case sensitive) - Two aliases which are null are equals - The alias which is not null is before null.Comparator<CvTerm>
getTypeComparator()
Getter for the fieldtypeComparator
.-
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
-
AliasComparator
public AliasComparator(Comparator<CvTerm> typeComparator)
Creates a new AliasComparator.- Parameters:
typeComparator
- : CvTerm comparator for alias types. It is required
-
-
Method Detail
-
getTypeComparator
public Comparator<CvTerm> getTypeComparator()
Getter for the field
typeComparator
.- Returns:
- a
Comparator
object.
-
compare
public int compare(Alias alias1, Alias alias2)
It will first compare alias types and then alias names (case sensitive) - Two aliases which are null are equals - The alias which is not null is before null. - If the alias types are not set, compares the names (case sensitive) - If both alias types are set, use CvTermComparator to compare the alias types. If they are equals, compares the names (case sensitive)- Specified by:
compare
in interfaceComparator<Alias>
- Parameters:
alias1
- : first aliasalias2
- : second alias- Returns:
- the comparison value
-
-