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)
| 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() { |
no test coverage detected