@Test public void testMatchCommunities() { Set<Community> matchingCommunitySetCandidate1 = ImmutableSet.of(StandardCommunity.of(1L), StandardCommunity.of(2L)); Set<Community> matchingCommunitySetCandidate2 = ImmutableSet.of(StandardCommunity.of(1L)); Set<Community> nonMatchingCommunitySetCandidate = ImmutableSet.of(StandardCommunity.of(2L)); LiteralCommunitySet l = new LiteralCommunitySet( ImmutableSet.of(StandardCommunity.of(1L), StandardCommunity.of(3L))); assertThat(l, matchCommunities(null, matchingCommunitySetCandidate1)); assertThat(l, matchCommunities(null, matchingCommunitySetCandidate2)); assertThat(l, not(matchCommunities(null, nonMatchingCommunitySetCandidate))); }
@Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return communitySetCandidate.stream().anyMatch(_communities::contains); }
LiteralCommunitySet extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return communitySetCandidate.stream().anyMatch(_communities::contains); } }
LiteralCommunitySet extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return communitySetCandidate.stream().anyMatch(_communities::contains); } LiteralCommunitySet(@Nonnull Collection<? extends Community> communities); }
LiteralCommunitySet extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return communitySetCandidate.stream().anyMatch(_communities::contains); } LiteralCommunitySet(@Nonnull Collection<? extends Community> communities); @Override T accept(CommunitySetExprVisitor<T> visitor); @Override void accept(VoidCommunitySetExprVisitor visitor); @Nonnull @Override Set<Community> asLiteralCommunities(@Nonnull Environment environment); @Override boolean dynamicMatchCommunity(); @Override boolean equals(Object obj); @Nonnull Set<Community> getCommunities(); @Override int hashCode(); @Override boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate); @Override boolean matchCommunity(Environment environment, Community community); @Override boolean reducible(); @Override String toString(); }
LiteralCommunitySet extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return communitySetCandidate.stream().anyMatch(_communities::contains); } LiteralCommunitySet(@Nonnull Collection<? extends Community> communities); @Override T accept(CommunitySetExprVisitor<T> visitor); @Override void accept(VoidCommunitySetExprVisitor visitor); @Nonnull @Override Set<Community> asLiteralCommunities(@Nonnull Environment environment); @Override boolean dynamicMatchCommunity(); @Override boolean equals(Object obj); @Nonnull Set<Community> getCommunities(); @Override int hashCode(); @Override boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate); @Override boolean matchCommunity(Environment environment, Community community); @Override boolean reducible(); @Override String toString();  }