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

Method getCoextensiveAnnotationsWorker

src/main/java/gate/Utils.java:1065–1087  ·  view source on GitHub ↗
(AnnotationSet source,
      String type, long start, long end)

Source from the content-addressed store, hash-verified

1063 }
1064
1065 private static AnnotationSet getCoextensiveAnnotationsWorker(AnnotationSet source,
1066 String type, long start, long end) {
1067 if (source instanceof gate.annotation.AnnotationSetImpl) {
1068 AnnotationSet ret = ((AnnotationSetImpl) source).getStrict(start,
1069 end);
1070 if (type != null) {
1071 return ret.get(type);
1072 } else {
1073 return ret;
1074 }
1075 } else {
1076 AnnotationSet annset = source.getContained(start, end);
1077 List<Annotation> annotationsToAdd = new ArrayList<Annotation>();
1078 for (Annotation ann : annset) {
1079 if (start(ann) == start && end(ann) == end) {
1080 if (type == null || ann.getType().equals(type)) {
1081 annotationsToAdd.add(ann);
1082 }
1083 }
1084 }
1085 return Factory.createImmutableAnnotationSet(source.getDocument(), annotationsToAdd);
1086 }
1087 }
1088
1089 /**
1090 * This will replace all occurrences of variables of the form $env{name},

Callers 1

Calls 10

getMethod · 0.95
startMethod · 0.95
endMethod · 0.95
getStrictMethod · 0.80
getContainedMethod · 0.65
equalsMethod · 0.65
getTypeMethod · 0.65
addMethod · 0.65
getDocumentMethod · 0.65

Tested by

no test coverage detected