Class UnambiguousRangeComparator

  • All Implemented Interfaces:
    Comparator<Range>

    public class UnambiguousRangeComparator
    extends RangeComparator
    Unambiguous RangeComparator. It compares first the start Position, then the end Position using a UnambiguousPositionComparator, If start/end positions are equals, the linked ranges will always come before the ranges that are not linked. - Two ranges which are null are equals - The range which is not null is before null.
    Since:
    21/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • UnambiguousRangeComparator

        public UnambiguousRangeComparator()
        Creates a new DefaultRangeComparator with DefaultPositionComparator
    • Method Detail

      • compare

        public int compare​(Range range1,
                           Range range2)
        Description copied from class: RangeComparator
        It compares first the start Position, then the end Position using a PositionComparator, If start/end positions are equals, the linked ranges will always come before the ranges that are not linked. - Two ranges which are null are equals - The range which is not null is before null.
        Specified by:
        compare in interface Comparator<Range>
        Overrides:
        compare in class RangeComparator
        Parameters:
        range1 - a Range object.
        range2 - a Range object.
        Returns:
        a int.
      • areEquals

        public static boolean areEquals​(Range range1,
                                        Range range2)
        Use DefaultRangeComparator to know if two ranges are equals.
        Parameters:
        range1 - a Range object.
        range2 - a Range object.
        Returns:
        true if the two ranges are equal
      • hashCode

        public static int hashCode​(Range range)

        hashCode

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