public AnnotationDB search(AnnotationType at) { Set hits = new HashSet(); for (Iterator i = anns.iterator(); i.hasNext(); ) { Annotation ann = (Annotation) i.next(); hits.addAll(AnnotationTools.searchAnnotation(ann, at)); } if (hits.isEmpty()) { return AnnotationDB.EMPTY; } else { return new SimpleAnnotationDB("", hits, at); } }
public AnnotationDB filter(AnnotationType at) { Set hits = new HashSet(); AnnotationType intersection = AnnotationTools.intersection(schema, at); if (intersection != AnnotationType.NONE) { for (Iterator i = anns.iterator(); i.hasNext(); ) { Annotation ann = (Annotation) i.next(); if (at.instanceOf(ann)) { hits.add(ann); } } } if (hits.isEmpty()) { return AnnotationDB.EMPTY; } else { return new SimpleAnnotationDB("", hits, intersection); } }