@Test public void testVisitCommunitySetMatchAll() { CommunitySetMatchAll csma = new CommunitySetMatchAll( ImmutableList.of( new HasCommunity( new CommunityMatchRegex(ColonSeparatedRendering.instance(), "^20:")), new HasCommunity( new CommunityMatchRegex(ColonSeparatedRendering.instance(), ":30$")))); BDD result = _communitySetMatchExprToBDD.visitCommunitySetMatchAll(csma, _arg); CommunityVar cvar1 = CommunityVar.from("^20:"); CommunityVar cvar2 = CommunityVar.from(":30$"); assertEquals(cvarToBDD(cvar1).and(cvarToBDD(cvar2)), result); }
@Override public BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg) { return communitySetMatchAll.getExprs().stream() .map(expr -> expr.accept(this, arg)) .reduce(BDDRoute.factory.one(), BDD::and); }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg) { return communitySetMatchAll.getExprs().stream() .map(expr -> expr.accept(this, arg)) .reduce(BDDRoute.factory.one(), BDD::and); } }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg) { return communitySetMatchAll.getExprs().stream() .map(expr -> expr.accept(this, arg)) .reduce(BDDRoute.factory.one(), BDD::and); }  }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg) { return communitySetMatchAll.getExprs().stream() .map(expr -> expr.accept(this, arg)) .reduce(BDDRoute.factory.one(), BDD::and); }  @Override BDD visitCommunitySetAcl(CommunitySetAcl communitySetAcl, Arg arg); @Override BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg); @Override BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg); @Override BDD visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, Arg arg); @Override BDD visitCommunitySetMatchRegex(CommunitySetMatchRegex communitySetMatchRegex, Arg arg); @Override BDD visitCommunitySetNot(CommunitySetNot communitySetNot, Arg arg); @Override BDD visitHasCommunity(HasCommunity hasCommunity, Arg arg); }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg) { return communitySetMatchAll.getExprs().stream() .map(expr -> expr.accept(this, arg)) .reduce(BDDRoute.factory.one(), BDD::and); }  @Override BDD visitCommunitySetAcl(CommunitySetAcl communitySetAcl, Arg arg); @Override BDD visitCommunitySetMatchAll(CommunitySetMatchAll communitySetMatchAll, Arg arg); @Override BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg); @Override BDD visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, Arg arg); @Override BDD visitCommunitySetMatchRegex(CommunitySetMatchRegex communitySetMatchRegex, Arg arg); @Override BDD visitCommunitySetNot(CommunitySetNot communitySetNot, Arg arg); @Override BDD visitHasCommunity(HasCommunity hasCommunity, Arg arg);  }