Class Comparators


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

      Constructors 
      Constructor Description
      Comparators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      java.util.Comparator<T>
      beginOffsetComparator()  
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      java.util.Comparator<T>
      endOffsetComparator()  
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      java.util.Comparator<T>
      exactOffsetMatchComparator()
      Compares annotations strictly by their offsets.
      static java.util.Comparator<java.lang.Long> longOverlapComparator()  
      static <T extends org.apache.uima.jcas.tcas.Annotation>
      java.util.Comparator<T>
      overlapComparator()
      Compares annotations for any kind of overlapping.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Comparators

        public Comparators()
    • Method Detail

      • exactOffsetMatchComparator

        public static <T extends org.apache.uima.jcas.tcas.Annotation> java.util.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> java.util.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> java.util.Comparator<T> beginOffsetComparator()
      • endOffsetComparator

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

        public static java.util.Comparator<java.lang.Long> longOverlapComparator()