Class OrganismTaxIdComparator

  • All Implemented Interfaces:
    Comparator<Organism>
    Direct Known Subclasses:
    OrganismComparator

    public class OrganismTaxIdComparator
    extends Object
    implements Comparator<Organism>
    Simple organism comparator based on the taxIds. - Two organisms which are null are equals - The organism which is not null is before null.
    Since:
    21/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • OrganismTaxIdComparator

        public OrganismTaxIdComparator()
        Creates a new OrganismComparator
    • Method Detail

      • compare

        public int compare​(Organism organism1,
                           Organism organism2)
        Comparison is based on taxIds only. - Two organisms which are null are equals - The organism which is not null is before null.
        Specified by:
        compare in interface Comparator<Organism>
        Parameters:
        organism1 - a Organism object.
        organism2 - a Organism object.
        Returns:
        a int.
      • areEquals

        public static boolean areEquals​(Organism organism1,
                                        Organism organism2)
        Use OrganismTaxIdComparator to know if two organisms are equals.
        Parameters:
        organism1 - a Organism object.
        organism2 - a Organism object.
        Returns:
        true if the two organisms are equal
      • hashCode

        public static int hashCode​(Organism organism)

        hashCode

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