Class Comparators


  • public class Comparators
    extends Object
    This class offers some commonly used comparators on annotations.
    Author:
    faessler
    • Constructor Detail

      • Comparators

        public Comparators()
    • Method Detail

      • exactOffsetMatchComparator

        public static <T extends org.apache.uima.jcas.tcas.Annotation> Comparator<T> exactOffsetMatchComparator()
        Compares annotations strictly by their offsets. Two annotations are equal if both begin and end offsets are equal. If not, they are sorted by begin offset or, when those are equal, be end offset.
        Returns:
        The comparison value.
      • overlapComparator

        public static <T extends org.apache.uima.jcas.tcas.Annotation> Comparator<T> overlapComparator()
        Compares annotations for any kind of overlapping. As long as two annotations overlap for at least a single position, they are deemed "equal" by this comparator. Otherwise, they are sorted by begin offset.
        Returns:
        0 if annotations overlap, the start offset difference otherwise.
      • beginOffsetComparator

        public static <T extends org.apache.uima.jcas.tcas.Annotation> Comparator<T> beginOffsetComparator()
      • endOffsetComparator

        public static <T extends org.apache.uima.jcas.tcas.Annotation> Comparator<T> endOffsetComparator()
      • longOverlapComparator

        public static Comparator<Long> longOverlapComparator()