class CommunityMatchExprVarCollector implements CommunityMatchExprVisitor<Set<CommunityVar>, Configuration> {

  @Override
  public Set<CommunityVar> visitCommunityMatchExprReference(
      CommunityMatchExprReference communityMatchExprReference, Configuration arg) {
    String name = communityMatchExprReference.getName();
    CommunityMatchExpr matchExpr = arg.getCommunityMatchExprs().get(name);
    if (matchExpr == null) {
      throw new BatfishException("Cannot find community match expression: " + name);
    }
    return matchExpr.accept(this, arg);
  }

}