@Test public void testVisitCommunitySetMatchAny() { CommunitySetMatchAny csma = new CommunitySetMatchAny( ImmutableList.of( new HasCommunity( new CommunityMatchRegex(ColonSeparatedRendering.instance(), "^20:")), new HasCommunity( new CommunityMatchRegex(ColonSeparatedRendering.instance(), ":30$")))); BDD result = _communitySetMatchExprToBDD.visitCommunitySetMatchAny(csma, _arg); CommunityVar cvar1 = CommunityVar.from("^20:"); CommunityVar cvar2 = CommunityVar.from(":30$"); assertEquals(cvarToBDD(cvar1).or(cvarToBDD(cvar2)), result); }
@Override public BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg) { return BDDRoute.factory.orAll( communitySetMatchAny.getExprs().stream() .map(expr -> expr.accept(this, arg)) .collect(ImmutableList.toImmutableList())); }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg) { return BDDRoute.factory.orAll( communitySetMatchAny.getExprs().stream() .map(expr -> expr.accept(this, arg)) .collect(ImmutableList.toImmutableList())); } }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg) { return BDDRoute.factory.orAll( communitySetMatchAny.getExprs().stream() .map(expr -> expr.accept(this, arg)) .collect(ImmutableList.toImmutableList())); }  }
CommunitySetMatchExprToBDD implements CommunitySetMatchExprVisitor<BDD, CommunitySetMatchExprToBDD.Arg> { @Override public BDD visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg) { return BDDRoute.factory.orAll( communitySetMatchAny.getExprs().stream() .map(expr -> expr.accept(this, arg)) .collect(ImmutableList.toImmutableList())); }  @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 visitCommunitySetMatchAny(CommunitySetMatchAny communitySetMatchAny, Arg arg) { return BDDRoute.factory.orAll( communitySetMatchAny.getExprs().stream() .map(expr -> expr.accept(this, arg)) .collect(ImmutableList.toImmutableList())); }  @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);  }