Class 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 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 interface Comparator<Alias>
        Parameters:
        alias1 - : first alias
        alias2 - : second alias
        Returns:
        the comparison value