Class ComparatorUtils


  • public class ComparatorUtils
    extends Object
    Utility class for Comparator
    Since:
    01/02/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • ComparatorUtils

        public ComparatorUtils()
    • Method Detail

      • compareIdentifiersWithDefaultIdentifier

        public static int compareIdentifiersWithDefaultIdentifier​(String identifier1,
                                                                  String identifier2,
                                                                  String firstIdentifier)
        If identifier1 and identifier2 are equals, it returns 0. If identifier1 and identifier2 are not equals: - the external identifier that is equal to firstIdentifier will always come first - if both external identifiers are different from the the first identifier, it will return the results of identifier1.compareTo(identifier2)
        Parameters:
        identifier1 - : first identifier to compare
        identifier2 - : second identifier to compare
        firstIdentifier - : the default identifier that we want to have first
        Returns:
        a int.
      • findAtLeastOneMatchingIdentifier

        public static boolean findAtLeastOneMatchingIdentifier​(Collection<? extends Xref> identifiers1,
                                                               Collection<? extends Xref> identifiers2)
        True if there is at least one identifier in identifiers1 that is identical to at least one identifier in identfiers2 ( equality based on DefaultExternalIdentifierComparator.areEquals)
        Parameters:
        identifiers1 - a Collection object.
        identifiers2 - a Collection object.
        Returns:
        a boolean.
      • findAtLeastOneMatchingAlias

        public static boolean findAtLeastOneMatchingAlias​(Collection<? extends Alias> aliases1,
                                                          Collection<? extends Alias> aliases2)

        findAtLeastOneMatchingAlias

        Parameters:
        aliases1 - a Collection object.
        aliases2 - a Collection object.
        Returns:
        a boolean.