Class UnambiguousAliasComparator

  • All Implemented Interfaces:
    Comparator<Alias>

    public class UnambiguousAliasComparator
    extends AliasComparator
    Unambiguous alias comparator. It will first compare alias types using UnambiguousCvTermComparator 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 UnambiguousCvTermComparator 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

      • UnambiguousAliasComparator

        public UnambiguousAliasComparator()
        Creates a new AliasComparator with DefaultCvTermComparator
    • Method Detail

      • 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) It will first compare alias types using UnambiguousCvTermComparator 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 UnambiguousCvTermComparator to compare the alias types. If they are equals, compares the names (case sensitive)
        Specified by:
        compare in interface Comparator<Alias>
        Overrides:
        compare in class AliasComparator
        Parameters:
        alias1 - a Alias object.
        alias2 - a Alias object.
        Returns:
        the comparison value
      • areEquals

        public static boolean areEquals​(Alias alias1,
                                        Alias alias2)
        Use UnambiguousAliasComparator to know if two aliases are equals.
        Parameters:
        alias1 - a Alias object.
        alias2 - a Alias object.
        Returns:
        true if the two aliases are equal
      • hashCode

        public static int hashCode​(Alias alias)

        hashCode

        Parameters:
        alias - a Alias object.
        Returns:
        the hashcode consistent with the equals method for this comparator