Class UnambiguousRangeAndResultingSequenceComparator

  • All Implemented Interfaces:
    Comparator<Range>

    public class UnambiguousRangeAndResultingSequenceComparator
    extends RangeAndResultingSequenceComparator
    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. Then, if the positions and linked boolean are the same, it will compare the resultingSequences using ResultingSequenceComparator - Two ranges which are null are equals - The range which is not null is before null.
    Since:
    21/05/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • UnambiguousRangeAndResultingSequenceComparator

        public UnambiguousRangeAndResultingSequenceComparator()
        Creates a new UnambiguousRangeAndResultingSequenceComparator with UnambiguousPositionComparator
    • Method Detail

      • compare

        public int compare​(Range range1,
                           Range range2)
        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. Then, if the positions and linked boolean are the same, it will compare the resultingSequences using ResultingSequenceComparator - 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 RangeAndResultingSequenceComparator
        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