@Test public void testVisitCommunitySetUnion() { CommunitySetUnion csu = CommunitySetUnion.of( new LiteralCommunitySet(CommunitySet.of(StandardCommunity.parse("20:30"))), new LiteralCommunitySet(CommunitySet.of(StandardCommunity.parse("21:30")))); Set<CommunityVar> result = _varCollector.visitCommunitySetUnion(csu, _baseConfig); CommunityVar cvar1 = CommunityVar.from(StandardCommunity.parse("20:30")); CommunityVar cvar2 = CommunityVar.from(StandardCommunity.parse("21:30")); assertEquals(ImmutableSet.of(cvar1, cvar2), result); }
@Override public Set<CommunityVar> visitCommunitySetUnion( CommunitySetUnion communitySetUnion, Configuration arg) { return communitySetUnion.getExprs().stream() .flatMap(e -> e.accept(this, arg).stream()) .collect(ImmutableSet.toImmutableSet()); }
SetCommunitiesVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetUnion( CommunitySetUnion communitySetUnion, Configuration arg) { return communitySetUnion.getExprs().stream() .flatMap(e -> e.accept(this, arg).stream()) .collect(ImmutableSet.toImmutableSet()); } }
SetCommunitiesVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetUnion( CommunitySetUnion communitySetUnion, Configuration arg) { return communitySetUnion.getExprs().stream() .flatMap(e -> e.accept(this, arg).stream()) .collect(ImmutableSet.toImmutableSet()); }  }
SetCommunitiesVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetUnion( CommunitySetUnion communitySetUnion, Configuration arg) { return communitySetUnion.getExprs().stream() .flatMap(e -> e.accept(this, arg).stream()) .collect(ImmutableSet.toImmutableSet()); }  @Override Set<CommunityVar> visitCommunityExprsSet(
      CommunityExprsSet communityExprsSet, Configuration arg); @Override Set<CommunityVar> visitCommunitySetDifference(
      CommunitySetDifference communitySetDifference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetExprReference(
      CommunitySetExprReference communitySetExprReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetReference(
      CommunitySetReference communitySetReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetUnion(
      CommunitySetUnion communitySetUnion, Configuration arg); @Override Set<CommunityVar> visitInputCommunities(
      InputCommunities inputCommunities, Configuration arg); @Override Set<CommunityVar> visitLiteralCommunitySet(
      LiteralCommunitySet literalCommunitySet, Configuration arg); }
SetCommunitiesVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetUnion( CommunitySetUnion communitySetUnion, Configuration arg) { return communitySetUnion.getExprs().stream() .flatMap(e -> e.accept(this, arg).stream()) .collect(ImmutableSet.toImmutableSet()); }  @Override Set<CommunityVar> visitCommunityExprsSet(
      CommunityExprsSet communityExprsSet, Configuration arg); @Override Set<CommunityVar> visitCommunitySetDifference(
      CommunitySetDifference communitySetDifference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetExprReference(
      CommunitySetExprReference communitySetExprReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetReference(
      CommunitySetReference communitySetReference, Configuration arg); @Override Set<CommunityVar> visitCommunitySetUnion(
      CommunitySetUnion communitySetUnion, Configuration arg); @Override Set<CommunityVar> visitInputCommunities(
      InputCommunities inputCommunities, Configuration arg); @Override Set<CommunityVar> visitLiteralCommunitySet(
      LiteralCommunitySet literalCommunitySet, Configuration arg);  }