Package de.julielab.jcore.utility.index
Class Comparators
- java.lang.Object
-
- de.julielab.jcore.utility.index.Comparators
-
public class Comparators extends 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>
Comparator<T>beginOffsetComparator()static <T extends org.apache.uima.jcas.tcas.Annotation>
Comparator<T>endOffsetComparator()static <T extends org.apache.uima.jcas.tcas.Annotation>
Comparator<T>exactOffsetMatchComparator()Compares annotations strictly by their offsets.static Comparator<Long>longOverlapComparator()static <T extends org.apache.uima.jcas.tcas.Annotation>
Comparator<T>overlapComparator()Compares annotations for any kind of overlapping.
-
-
-
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()
-
-