@Test public void testIsAccepted() { Dependency dep1 = new Dependency(new Node("n1"), new Node("n2"), DependencyType.CONTAINS); Dependency dep2 = new Dependency(new Node("n1"), new Node("n2"), DependencyType.INHERIT); Dependency dep3 = new Dependency(new Node("n1"), new Node("n2"), DependencyType.READ_ONLY); EdgeFilter filter1 = new DependencyTypeEdgeOutFilter(DependencyType.CONTAINS); assertThat(filter1.isAccepted(dep1), is(false)); assertThat(filter1.isAccepted(dep2), is(true)); EdgeFilter filter2 = new DependencyTypeEdgeOutFilter(DependencyType.CONTAINS, DependencyType.INHERIT); assertThat(filter2.isAccepted(dep1), is(false)); assertThat(filter2.isAccepted(dep2), is(false)); assertThat(filter2.isAccepted(dep3), is(true)); EdgeFilter filter3 = new DependencyTypeEdgeOutFilter(DependencyType.CONTAINS, DependencyType.INHERIT, DependencyType.READ_ONLY); assertThat(filter3.isAccepted(dep3), is(false)); }
@Override public boolean isAccepted(Dependency edge) { return unwantedTypes.stream().noneMatch(unwantedType -> edge.getDependencyType() == unwantedType); }
DependencyTypeEdgeOutFilter implements EdgeFilter { @Override public boolean isAccepted(Dependency edge) { return unwantedTypes.stream().noneMatch(unwantedType -> edge.getDependencyType() == unwantedType); } }
DependencyTypeEdgeOutFilter implements EdgeFilter { @Override public boolean isAccepted(Dependency edge) { return unwantedTypes.stream().noneMatch(unwantedType -> edge.getDependencyType() == unwantedType); } DependencyTypeEdgeOutFilter(DependencyType... unwantedTypes); }
DependencyTypeEdgeOutFilter implements EdgeFilter { @Override public boolean isAccepted(Dependency edge) { return unwantedTypes.stream().noneMatch(unwantedType -> edge.getDependencyType() == unwantedType); } DependencyTypeEdgeOutFilter(DependencyType... unwantedTypes); @Override boolean isAccepted(Dependency edge); }
DependencyTypeEdgeOutFilter implements EdgeFilter { @Override public boolean isAccepted(Dependency edge) { return unwantedTypes.stream().noneMatch(unwantedType -> edge.getDependencyType() == unwantedType); } DependencyTypeEdgeOutFilter(DependencyType... unwantedTypes); @Override boolean isAccepted(Dependency edge);  }