@Test public void testApplyWithValidAttributes(){ Attribute.Name attributeName = Attribute.Name.valueOf("test-attr"); Object attributeValue = "test-attr-value"; EqualToPredicate equalToPredicate = new EqualToPredicate(attributeName, attributeValue); GraphAttribute graphAttribute = new GraphAttribute(attributeName, attributeValue, new MockMetadata()); List<Attribute> attributes = new ArrayList<Attribute>( Arrays.asList(graphAttribute)); StreamPredicate[] predicates = new StreamPredicate[1]; predicates[0] = equalToPredicate; OrPredicate orPredicate = new OrPredicate(predicates); assertTrue(orPredicate.apply(attributes)); }
@Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (predicate.apply(attributes)) { return true; } } return false; }
OrPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (predicate.apply(attributes)) { return true; } } return false; } }
OrPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (predicate.apply(attributes)) { return true; } } return false; } OrPredicate();  OrPredicate(StreamPredicate... predicates); }
OrPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (predicate.apply(attributes)) { return true; } } return false; } OrPredicate();  OrPredicate(StreamPredicate... predicates); @Override StreamPredicate[] getPredicates(); @Override void setPredicates(StreamPredicate[] predicates); @Override boolean apply(Collection<Attribute> attributes); }
OrPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (predicate.apply(attributes)) { return true; } } return false; } OrPredicate();  OrPredicate(StreamPredicate... predicates); @Override StreamPredicate[] getPredicates(); @Override void setPredicates(StreamPredicate[] predicates); @Override boolean apply(Collection<Attribute> attributes);  }