Class RangeComparator

  • All Implemented Interfaces:
    Comparator<Range>
    Direct Known Subclasses:
    RangeAndResultingSequenceComparator, UnambiguousRangeComparator

    public class RangeComparator
    extends Object
    implements Comparator<Range>
    Simple range comparator. 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.
    Since:
    21/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • RangeComparator

        public RangeComparator​(PositionComparator positionComparator)
        Creates a new RangeComparator
        Parameters:
        positionComparator - : the position comparator is required to compare start/end positions
    • Method Detail

      • compare

        public int compare​(Range range1,
                           Range range2)
        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>
        Parameters:
        range1 - a Range object.
        range2 - a Range object.
        Returns:
        a int.