public void testDisjointAnnotationTypesContains() { AnnotationType atype = new AnnotationType.Impl(); atype.setDefaultConstraints(PropertyConstraint.NONE, CardinalityConstraint.ZERO); atype.setConstraints("foo", PropertyConstraint.ANY, CardinalityConstraint.ONE); assertTrue( FilterUtils.areDisjoint( new FeatureFilter.ByAnnotationType(atype), new FeatureFilter.AnnotationContains("bar", "some_value"))); assertTrue( !FilterUtils.areDisjoint( new FeatureFilter.ByAnnotationType(atype), new FeatureFilter.AnnotationContains("foo", "some_value"))); }
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); } }