@Test public void testVisitCommunitySetUnion() { CommunitySet cs1 = CommunitySet.of(StandardCommunity.of(1L)); CommunitySet cs2 = CommunitySet.of(StandardCommunity.of(2L)); assertThat( eval(CommunitySetUnion.of(new LiteralCommunitySet(cs1), new LiteralCommunitySet(cs2))), equalTo(CommunitySet.of(StandardCommunity.of(1L), StandardCommunity.of(2L)))); }
@Override public @Nonnull CommunitySet visitCommunitySetUnion( CommunitySetUnion communitySetUnion, CommunityContext arg) { ImmutableSet.Builder<Community> builder = ImmutableSet.builder(); communitySetUnion .getExprs() .forEach(expr -> builder.addAll(expr.accept(this, arg).getCommunities())); return CommunitySet.of(builder.build()); }
CommunitySetExprEvaluator implements CommunitySetExprVisitor<CommunitySet, CommunityContext> { @Override public @Nonnull CommunitySet visitCommunitySetUnion( CommunitySetUnion communitySetUnion, CommunityContext arg) { ImmutableSet.Builder<Community> builder = ImmutableSet.builder(); communitySetUnion .getExprs() .forEach(expr -> builder.addAll(expr.accept(this, arg).getCommunities())); return CommunitySet.of(builder.build()); } }
CommunitySetExprEvaluator implements CommunitySetExprVisitor<CommunitySet, CommunityContext> { @Override public @Nonnull CommunitySet visitCommunitySetUnion( CommunitySetUnion communitySetUnion, CommunityContext arg) { ImmutableSet.Builder<Community> builder = ImmutableSet.builder(); communitySetUnion .getExprs() .forEach(expr -> builder.addAll(expr.accept(this, arg).getCommunities())); return CommunitySet.of(builder.build()); } private  CommunitySetExprEvaluator(); }
CommunitySetExprEvaluator implements CommunitySetExprVisitor<CommunitySet, CommunityContext> { @Override public @Nonnull CommunitySet visitCommunitySetUnion( CommunitySetUnion communitySetUnion, CommunityContext arg) { ImmutableSet.Builder<Community> builder = ImmutableSet.builder(); communitySetUnion .getExprs() .forEach(expr -> builder.addAll(expr.accept(this, arg).getCommunities())); return CommunitySet.of(builder.build()); } private  CommunitySetExprEvaluator(); static @Nonnull CommunitySetExprEvaluator instance(); @Override @Nonnull CommunitySet visitInputCommunities(
      InputCommunities inputCommunities, CommunityContext arg); @Override CommunitySet visitCommunityExprsSet(
      CommunityExprsSet communityExprsSet, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetDifference(
      CommunitySetDifference communitySetDifference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetExprReference(
      CommunitySetExprReference communitySetExprReference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetReference(
      CommunitySetReference communitySetReference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetUnion(
      CommunitySetUnion communitySetUnion, CommunityContext arg); @Override @Nonnull CommunitySet visitLiteralCommunitySet(
      LiteralCommunitySet literalCommunitySet, CommunityContext arg); }
CommunitySetExprEvaluator implements CommunitySetExprVisitor<CommunitySet, CommunityContext> { @Override public @Nonnull CommunitySet visitCommunitySetUnion( CommunitySetUnion communitySetUnion, CommunityContext arg) { ImmutableSet.Builder<Community> builder = ImmutableSet.builder(); communitySetUnion .getExprs() .forEach(expr -> builder.addAll(expr.accept(this, arg).getCommunities())); return CommunitySet.of(builder.build()); } private  CommunitySetExprEvaluator(); static @Nonnull CommunitySetExprEvaluator instance(); @Override @Nonnull CommunitySet visitInputCommunities(
      InputCommunities inputCommunities, CommunityContext arg); @Override CommunitySet visitCommunityExprsSet(
      CommunityExprsSet communityExprsSet, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetDifference(
      CommunitySetDifference communitySetDifference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetExprReference(
      CommunitySetExprReference communitySetExprReference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetReference(
      CommunitySetReference communitySetReference, CommunityContext arg); @Override @Nonnull CommunitySet visitCommunitySetUnion(
      CommunitySetUnion communitySetUnion, CommunityContext arg); @Override @Nonnull CommunitySet visitLiteralCommunitySet(
      LiteralCommunitySet literalCommunitySet, CommunityContext arg);  }