@Test public void testVisitCommunitySetMatchAll() { assertTrue(new CommunitySetMatchAll(ImmutableList.of()).accept(EVAL, CommunitySet.empty())); CommunitySetMatchAll twoOneMatchable = new CommunitySetMatchAll( ImmutableList.of( new HasCommunity(AllStandardCommunities.instance()), new CommunitySetNot(new HasCommunity(AllStandardCommunities.instance())))); assertFalse(twoOneMatchable.accept(EVAL, CommunitySet.empty())); assertFalse(twoOneMatchable.accept(EVAL, CommunitySet.of(StandardCommunity.of(1L)))); CommunitySetMatchAll twoBothMatchable = new CommunitySetMatchAll( ImmutableList.of( new HasCommunity(AllStandardCommunities.instance()), new HasCommunity(AllExtendedCommunities.instance()))); assertTrue( twoBothMatchable.accept( EVAL, CommunitySet.of(StandardCommunity.of(1L), ExtendedCommunity.of(1, 1L, 1L)))); }
@Override public @Nonnull Boolean visitCommunitySetMatchAll( CommunitySetMatchAll communitySetMatchAll, CommunitySet arg) { return communitySetMatchAll.getExprs().stream().allMatch(expr -> expr.accept(this, arg)); }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetMatchAll( CommunitySetMatchAll communitySetMatchAll, CommunitySet arg) { return communitySetMatchAll.getExprs().stream().allMatch(expr -> expr.accept(this, arg)); } }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetMatchAll( CommunitySetMatchAll communitySetMatchAll, CommunitySet arg) { return communitySetMatchAll.getExprs().stream().allMatch(expr -> expr.accept(this, arg)); } CommunitySetMatchExprEvaluator(CommunityContext ctx); }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetMatchAll( CommunitySetMatchAll communitySetMatchAll, CommunitySet arg) { return communitySetMatchAll.getExprs().stream().allMatch(expr -> expr.accept(this, arg)); } CommunitySetMatchExprEvaluator(CommunityContext ctx); @Override @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchAll(
      CommunitySetMatchAll communitySetMatchAll, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchAny(
      CommunitySetMatchAny communitySetMatchAny, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchRegex(
      CommunitySetMatchRegex communitySetMatchRegex, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetNot(CommunitySetNot communitySetNot, CommunitySet arg); @Override @Nonnull Boolean visitHasCommunity(HasCommunity hasCommunity, CommunitySet arg); }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetMatchAll( CommunitySetMatchAll communitySetMatchAll, CommunitySet arg) { return communitySetMatchAll.getExprs().stream().allMatch(expr -> expr.accept(this, arg)); } CommunitySetMatchExprEvaluator(CommunityContext ctx); @Override @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchAll(
      CommunitySetMatchAll communitySetMatchAll, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchAny(
      CommunitySetMatchAny communitySetMatchAny, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetMatchRegex(
      CommunitySetMatchRegex communitySetMatchRegex, CommunitySet arg); @Override @Nonnull Boolean visitCommunitySetNot(CommunitySetNot communitySetNot, CommunitySet arg); @Override @Nonnull Boolean visitHasCommunity(HasCommunity hasCommunity, CommunitySet arg);  }