@Test public void testVisitCommunitySetMatchExprReference() { String name = "name"; _baseConfig.setCommunitySetMatchExprs( ImmutableMap.of( name, new HasCommunity(new CommunityMatchRegex(ColonSeparatedRendering.instance(), "^20:")))); CommunitySetMatchExprReference csmer = new CommunitySetMatchExprReference(name); Set<CommunityVar> result = _varCollector.visitCommunitySetMatchExprReference(csmer, _baseConfig); CommunityVar cvar = CommunityVar.from("^20:"); assertEquals(ImmutableSet.of(cvar), result); }
@Override public Set<CommunityVar> visitCommunitySetMatchExprReference( CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg) { String name = communitySetMatchExprReference.getName(); CommunitySetMatchExpr expr = arg.getCommunitySetMatchExprs().get(name); if (expr == null) { throw new BatfishException("Cannot find community set match expression: " + name); } return expr.accept(this, arg); }
CommunitySetMatchExprVarCollector implements CommunitySetMatchExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetMatchExprReference( CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg) { String name = communitySetMatchExprReference.getName(); CommunitySetMatchExpr expr = arg.getCommunitySetMatchExprs().get(name); if (expr == null) { throw new BatfishException("Cannot find community set match expression: " + name); } return expr.accept(this, arg); } }
CommunitySetMatchExprVarCollector implements CommunitySetMatchExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetMatchExprReference( CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg) { String name = communitySetMatchExprReference.getName(); CommunitySetMatchExpr expr = arg.getCommunitySetMatchExprs().get(name); if (expr == null) { throw new BatfishException("Cannot find community set match expression: " + name); } return expr.accept(this, arg); }  }
CommunitySetMatchExprVarCollector implements CommunitySetMatchExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetMatchExprReference( CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg) { String name = communitySetMatchExprReference.getName(); CommunitySetMatchExpr expr = arg.getCommunitySetMatchExprs().get(name); if (expr == null) { throw new BatfishException("Cannot find community set match expression: " + name); } return expr.accept(this, arg); }  @Override Set<CommunityVar> visitCommunitySetAcl(
      CommunitySetAcl communitySetAcl, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchAll(
      CommunitySetMatchAll communitySetMatchAll, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchAny(
      CommunitySetMatchAny communitySetMatchAny, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchRegex(
      CommunitySetMatchRegex communitySetMatchRegex, Configuration arg); @Override Set<CommunityVar> visitCommunitySetNot(
      CommunitySetNot communitySetNot, Configuration arg); @Override Set<CommunityVar> visitHasCommunity(HasCommunity hasCommunity, Configuration arg); }
CommunitySetMatchExprVarCollector implements CommunitySetMatchExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetMatchExprReference( CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg) { String name = communitySetMatchExprReference.getName(); CommunitySetMatchExpr expr = arg.getCommunitySetMatchExprs().get(name); if (expr == null) { throw new BatfishException("Cannot find community set match expression: " + name); } return expr.accept(this, arg); }  @Override Set<CommunityVar> visitCommunitySetAcl(
      CommunitySetAcl communitySetAcl, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchAll(
      CommunitySetMatchAll communitySetMatchAll, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchAny(
      CommunitySetMatchAny communitySetMatchAny, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchExprReference(
      CommunitySetMatchExprReference communitySetMatchExprReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetMatchRegex(
      CommunitySetMatchRegex communitySetMatchRegex, Configuration arg); @Override Set<CommunityVar> visitCommunitySetNot(
      CommunitySetNot communitySetNot, Configuration arg); @Override Set<CommunityVar> visitHasCommunity(HasCommunity hasCommunity, Configuration arg);  }