@Test public void testVisitCommunitySetAcl() { assertFalse(new CommunitySetAcl(ImmutableList.of()).accept(EVAL, CommunitySet.empty())); CommunitySetAcl denyThenPermit = new CommunitySetAcl( ImmutableList.of( new CommunitySetAclLine( LineAction.DENY, new CommunitySetMatchAll( ImmutableList.of( new HasCommunity(AllStandardCommunities.instance()), new HasCommunity(AllExtendedCommunities.instance())))), new CommunitySetAclLine( LineAction.PERMIT, new HasCommunity(AllStandardCommunities.instance())))); assertFalse( denyThenPermit.accept( EVAL, CommunitySet.of(StandardCommunity.of(1L), ExtendedCommunity.of(1, 1L, 1L)))); assertTrue(denyThenPermit.accept(EVAL, CommunitySet.of(StandardCommunity.of(1L)))); assertFalse(denyThenPermit.accept(EVAL, CommunitySet.empty())); }
@Override public @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg) { for (CommunitySetAclLine line : communitySetAcl.getLines()) { if (line.getCommunitySetMatchExpr().accept(this, arg)) { return line.getAction() == LineAction.PERMIT; } } return false; }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg) { for (CommunitySetAclLine line : communitySetAcl.getLines()) { if (line.getCommunitySetMatchExpr().accept(this, arg)) { return line.getAction() == LineAction.PERMIT; } } return false; } }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg) { for (CommunitySetAclLine line : communitySetAcl.getLines()) { if (line.getCommunitySetMatchExpr().accept(this, arg)) { return line.getAction() == LineAction.PERMIT; } } return false; } CommunitySetMatchExprEvaluator(CommunityContext ctx); }
CommunitySetMatchExprEvaluator implements CommunitySetMatchExprVisitor<Boolean, CommunitySet> { @Override public @Nonnull Boolean visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg) { for (CommunitySetAclLine line : communitySetAcl.getLines()) { if (line.getCommunitySetMatchExpr().accept(this, arg)) { return line.getAction() == LineAction.PERMIT; } } return false; } 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 visitCommunitySetAcl(CommunitySetAcl communitySetAcl, CommunitySet arg) { for (CommunitySetAclLine line : communitySetAcl.getLines()) { if (line.getCommunitySetMatchExpr().accept(this, arg)) { return line.getAction() == LineAction.PERMIT; } } return false; } 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);  }