@Test public void testIsAccepted() throws Exception { NodeFilter f1 = new OrFilter(new TrueFilter(), new TrueFilter()); assertThat(f1.isAccepted(new Node("x")), is(true)); NodeFilter f2 = new OrFilter(new TrueFilter(), new NotFilter(new TrueFilter())); assertThat(f2.isAccepted(new Node("x")), is(true)); NodeFilter f3 = new OrFilter(new NotFilter(new TrueFilter()), new NotFilter(new TrueFilter())); assertThat(f3.isAccepted(new Node("x")), is(false)); }
@Override public boolean isAccepted(Node node) { return baseFilters.stream().anyMatch(filter -> filter.isAccepted(node)); }
OrFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return baseFilters.stream().anyMatch(filter -> filter.isAccepted(node)); } }
OrFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return baseFilters.stream().anyMatch(filter -> filter.isAccepted(node)); } OrFilter(NodeFilter... baseFilters); }
OrFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return baseFilters.stream().anyMatch(filter -> filter.isAccepted(node)); } OrFilter(NodeFilter... baseFilters); @Override boolean isAccepted(Node node); }
OrFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return baseFilters.stream().anyMatch(filter -> filter.isAccepted(node)); } OrFilter(NodeFilter... baseFilters); @Override boolean isAccepted(Node node);  }