Class 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 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 interface Comparator<Position>
        Parameters:
        position1 - a Position object.
        position2 - a Position object.
        Returns:
        a int.