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

Method getAnnotationsAtOffset

src/main/java/gate/Utils.java:325–339  ·  view source on GitHub ↗

Return a the subset of annotations from the given annotation set that start exactly at the given offset. @param annotationSet the set of annotations from which to select @param atOffset the offset where the annoation to be returned should start @return an annotation set containing all the annotatio

(
          AnnotationSet annotationSet, Long atOffset)

Source from the content-addressed store, hash-verified

323 * set that start at the given offset
324 */
325 public static AnnotationSet getAnnotationsAtOffset(
326 AnnotationSet annotationSet, Long atOffset) {
327 // this returns all annotations that start at this atOffset OR AFTER!
328 AnnotationSet tmp = annotationSet.get(atOffset);
329 // so lets filter ...
330 List<Annotation> ret = new ArrayList<Annotation>();
331 Iterator<Annotation> it = tmp.iterator();
332 while(it.hasNext()) {
333 Annotation ann = it.next();
334 if(ann.getStartNode().getOffset().equals(atOffset)) {
335 ret.add(ann);
336 }
337 }
338 return Factory.createImmutableAnnotationSet(annotationSet.getDocument(), ret);
339 }
340
341 public static AnnotationSet getAnnotationsEndingAtOffset(AnnotationSet annotationSet, Long endOffset) {
342 List<Annotation> endsAt = new ArrayList<Annotation>();

Callers 1

removeFromOffsetIndexMethod · 0.80

Calls 10

getMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
equalsMethod · 0.65
getOffsetMethod · 0.65
getStartNodeMethod · 0.65
addMethod · 0.65
getDocumentMethod · 0.65

Tested by

no test coverage detected