Class RangeAndResultingSequenceComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.range.RangeComparator
-
- psidev.psi.mi.jami.utils.comparator.range.RangeAndResultingSequenceComparator
-
- All Implemented Interfaces:
Comparator<Range>
- Direct Known Subclasses:
UnambiguousRangeAndResultingSequenceComparator
public class RangeAndResultingSequenceComparator extends RangeComparator
Simple range comparator that will also compare resulting sequences.. 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. Then, if the positions and linked boolean are the same, it will compare the resultingSequences using ResultingSequenceComparator- Since:
21/05/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description RangeAndResultingSequenceComparator(PositionComparator positionComparator)
Creates a new RangeComparator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.ResultingSequenceComparator
getResultingSequenceComparator()
Getter for the fieldresultingSequenceComparator
.-
Methods inherited from class psidev.psi.mi.jami.utils.comparator.range.RangeComparator
getPositionComparator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
RangeAndResultingSequenceComparator
public RangeAndResultingSequenceComparator(PositionComparator positionComparator)
Creates a new RangeComparator- Parameters:
positionComparator
- : the position comparator is required to compare start/end positions
-
-
Method Detail
-
getResultingSequenceComparator
public ResultingSequenceComparator getResultingSequenceComparator()
Getter for the field
resultingSequenceComparator
.- Returns:
- a
ResultingSequenceComparator
object.
-
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. 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. If both ranges have the same positions and linked property, 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 interfaceComparator<Range>
- Overrides:
compare
in classRangeComparator
- Parameters:
range1
- aRange
object.range2
- aRange
object.- Returns:
- a int.
-
-