Class PositionComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.range.PositionComparator
-
- All Implemented Interfaces:
Comparator<Position>
- Direct Known Subclasses:
UnambiguousPositionComparator
public class PositionComparator extends Object implements Comparator<Position>
Simple Position comparator. It will first compare the status and then will check if the position is undetermined. It will then check the start and the end. - Two positions which are null are equals - The position which is not null is before null. - An undetermined position always comes after a determined position - Two undetermined positions with same status are equals (no need to look at the positions start and end)- Since:
19/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description PositionComparator(Comparator<CvTerm> statusComparator)
Creates a new positionComparator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Position position1, Position position2)
It will first compare the status and then will check if the position is undetermined.Comparator<CvTerm>
getStatusComparator()
Getter for the fieldstatusComparator
.-
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
-
PositionComparator
public PositionComparator(Comparator<CvTerm> statusComparator)
Creates a new positionComparator- Parameters:
statusComparator
- : the status comparator is required for comparing the position status
-
-
Method Detail
-
getStatusComparator
public Comparator<CvTerm> getStatusComparator()
Getter for the field
statusComparator
.- Returns:
- a
Comparator
object.
-
compare
public int compare(Position position1, Position position2)
It will first compare the status and then will check if the position is undetermined. It will then check the start and the end. - Two positions which are null are equals - The position which is not null is before null. - An undetermined position always comes after a determined position - Two undetermined positions with same status are equals (no need to look at the positions start and end)- Specified by:
compare
in interfaceComparator<Position>
- Parameters:
position1
- aPosition
object.position2
- aPosition
object.- Returns:
- a int.
-
-