MCPcopy Create free account
hub / github.com/GateNLP/gate-core / getAnnotationsEndingAtOffset

Method getAnnotationsEndingAtOffset

src/main/java/gate/Utils.java:341–362  ·  view source on GitHub ↗
(AnnotationSet annotationSet, Long endOffset)

Source from the content-addressed store, hash-verified

339 }
340
341 public static AnnotationSet getAnnotationsEndingAtOffset(AnnotationSet annotationSet, Long endOffset) {
342 List<Annotation> endsAt = new ArrayList<Annotation>();
343
344 // start can't be negative
345 Long start = endOffset > 0 ? endOffset - 1 : 0;
346
347 // it seems we can ask for beyond the document without error
348 Long end = endOffset + 1;
349
350 // get annotations that overlap this bit
351 AnnotationSet annotations = annotationSet.get(start,end);
352
353 // filter to get just those that end at the offset
354 for (Annotation a : annotations) {
355 if (a.getEndNode().getOffset().equals(endOffset)) {
356 endsAt.add(a);
357 }
358 }
359
360 // return the annotations we've found, if any
361 return Factory.createImmutableAnnotationSet(annotationSet.getDocument(), endsAt);
362 }
363
364 /**
365 * Get all the annotations from the source annotation set that lie within

Callers 2

removeFromOffsetIndexMethod · 0.80

Calls 7

getMethod · 0.65
equalsMethod · 0.65
getOffsetMethod · 0.65
getEndNodeMethod · 0.65
addMethod · 0.65
getDocumentMethod · 0.65

Tested by 1