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

Method buildID2AnnotMap

src/test/java/gate/xml/TestXml.java:437–451  ·  view source on GitHub ↗

Scans a target Doc for all Annotations and builds a map (from anot ID to annot) in the process I also checks to see if there are two annotations with the same ID. @param aDoc The GATE doc to be scaned @return a Map ID2Annot

(Document aDoc)

Source from the content-addressed store, hash-verified

435 * @return a Map ID2Annot
436 */
437 private Map<Integer,Annotation> buildID2AnnotMap(Document aDoc){
438 Map<Integer,Annotation> id2AnnMap = new HashMap<Integer,Annotation>();
439 // Scan the default annotation set
440 AnnotationSet annotSet = aDoc.getAnnotations();
441 addAnnotSet2Map(annotSet, id2AnnMap);
442 // Scan all named annotation sets
443 if (aDoc.getNamedAnnotationSets() != null){
444 for ( Iterator<AnnotationSet> namedAnnotSetsIter = aDoc.getNamedAnnotationSets().values().iterator();
445 namedAnnotSetsIter.hasNext(); ){
446
447 addAnnotSet2Map(namedAnnotSetsIter.next(), id2AnnMap);
448 }// End while
449 }// End if
450 return id2AnnMap;
451 }// End of buildID2AnnotMap()
452
453 /** Test suite routine for the test runner */
454 public static Test suite() {

Calls 7

addAnnotSet2MapMethod · 0.95
getAnnotationsMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
valuesMethod · 0.45

Tested by

no test coverage detected