@Test public void testMatchCommunities() { Set<Community> matchingCommunitySetCandidate1 = ImmutableSet.of(StandardCommunity.of(1L), StandardCommunity.of(3L)); Set<Community> matchingCommunitySetCandidate2 = ImmutableSet.of( StandardCommunity.of(1L), StandardCommunity.of(2L), StandardCommunity.of(3L)); Set<Community> nonMatchingCommunitySetCandidate1 = ImmutableSet.of(StandardCommunity.of(1L)); Set<Community> nonMatchingCommunitySetCandidate2 = ImmutableSet.of(StandardCommunity.of(3L)); LiteralCommunityConjunction l = new LiteralCommunityConjunction( ImmutableSet.of(StandardCommunity.of(1L), StandardCommunity.of(3L))); assertThat(l, matchCommunities(null, matchingCommunitySetCandidate1)); assertThat(l, matchCommunities(null, matchingCommunitySetCandidate2)); assertThat(l, not(matchCommunities(null, nonMatchingCommunitySetCandidate1))); assertThat(l, not(matchCommunities(null, nonMatchingCommunitySetCandidate2))); }
@Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return Sets.intersection(_requiredCommunities, communitySetCandidate).size() == _requiredCommunities.size(); }
LiteralCommunityConjunction extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return Sets.intersection(_requiredCommunities, communitySetCandidate).size() == _requiredCommunities.size(); } }
LiteralCommunityConjunction extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return Sets.intersection(_requiredCommunities, communitySetCandidate).size() == _requiredCommunities.size(); } LiteralCommunityConjunction(@Nonnull Collection<? extends Community> requiredCommunities); }
LiteralCommunityConjunction extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return Sets.intersection(_requiredCommunities, communitySetCandidate).size() == _requiredCommunities.size(); } LiteralCommunityConjunction(@Nonnull Collection<? extends Community> requiredCommunities); @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); Set<Community> getRequiredCommunities(); @Override int hashCode(); @Override boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate); @Override boolean matchCommunity(Environment environment, Community community); @Override boolean reducible(); @Override String toString(); }
LiteralCommunityConjunction extends CommunitySetExpr { @Override public boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate) { return Sets.intersection(_requiredCommunities, communitySetCandidate).size() == _requiredCommunities.size(); } LiteralCommunityConjunction(@Nonnull Collection<? extends Community> requiredCommunities); @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); Set<Community> getRequiredCommunities(); @Override int hashCode(); @Override boolean matchCommunities(Environment environment, Set<Community> communitySetCandidate); @Override boolean matchCommunity(Environment environment, Community community); @Override boolean reducible(); @Override String toString();  }