Class UnambiguousPositionComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.range.PositionComparator
-
- psidev.psi.mi.jami.utils.comparator.range.UnambiguousPositionComparator
-
- All Implemented Interfaces:
Comparator<Position>
public class UnambiguousPositionComparator extends PositionComparator
Strict PositionComparator. It will first compare the status (using UnambiguousCvTermComparator) 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. - Use UnambiguousCvTermComparator to compare first the position status. - If position status are equals, the undetermined positions are always coming after the determined positions. - If both positions have same status and are undetermined, they are equals - If both positions are not undetermined, compare the start position first and then the end position- Since:
19/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description UnambiguousPositionComparator()
Creates a new positionComparator with UnambiguousCvTermComparator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
areEquals(Position pos1, Position pos2)
Use UnabmbiguousPositionComparator to know if two positions are equals.int
compare(Position position1, Position position2)
It will first compare the status and then will check if the position is undetermined.UnambiguousCvTermComparator
getStatusComparator()
Getter for the fieldstatusComparator
.static int
hashCode(Position pos)
hashCode-
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
-
-
-
-
Method Detail
-
getStatusComparator
public UnambiguousCvTermComparator getStatusComparator()
Getter for the field
statusComparator
.- Overrides:
getStatusComparator
in classPositionComparator
- 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) It will first compare the status (using UnambiguousCvTermComparator) 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. - Use UnambiguousCvTermComparator to compare first the position status. - If position status are equals, the undetermined positions are always coming after the determined positions. - If both positions have same status and are undetermined, they are equals - If both positions are not undetermined, compare the start position first and then the end position- Specified by:
compare
in interfaceComparator<Position>
- Overrides:
compare
in classPositionComparator
- Parameters:
position1
- aPosition
object.position2
- aPosition
object.- Returns:
- a int.
-
areEquals
public static boolean areEquals(Position pos1, Position pos2)
Use UnabmbiguousPositionComparator to know if two positions are equals.
-
-