@Test public void testVisitCommunitySetDifference() { CommunitySetDifference csd = new CommunitySetDifference( new LiteralCommunitySet(CommunitySet.of(StandardCommunity.parse("20:30"))), new CommunityMatchRegex(ColonSeparatedRendering.instance(), "^20:")); Set<CommunityVar> result = _varCollector.visitCommunitySetDifference(csd, _baseConfig); Set<CommunityVar> expected = ImmutableSet.of( CommunityVar.from(StandardCommunity.parse("20:30")), CommunityVar.from("^20:")); assertEquals(expected, result); }
@Override public Set<CommunityVar> visitCommunitySetDifference( CommunitySetDifference communitySetDifference, Configuration arg) { Set<CommunityVar> s1 = communitySetDifference.getInitial().accept(this, arg); Set<CommunityVar> s2 = communitySetDifference .getRemovalCriterion() .accept(new CommunityMatchExprVarCollector(), arg); return ImmutableSet.<CommunityVar>builder().addAll(s1).addAll(s2).build(); }
CommunitySetExprVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetDifference( CommunitySetDifference communitySetDifference, Configuration arg) { Set<CommunityVar> s1 = communitySetDifference.getInitial().accept(this, arg); Set<CommunityVar> s2 = communitySetDifference .getRemovalCriterion() .accept(new CommunityMatchExprVarCollector(), arg); return ImmutableSet.<CommunityVar>builder().addAll(s1).addAll(s2).build(); } }
CommunitySetExprVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetDifference( CommunitySetDifference communitySetDifference, Configuration arg) { Set<CommunityVar> s1 = communitySetDifference.getInitial().accept(this, arg); Set<CommunityVar> s2 = communitySetDifference .getRemovalCriterion() .accept(new CommunityMatchExprVarCollector(), arg); return ImmutableSet.<CommunityVar>builder().addAll(s1).addAll(s2).build(); }  }
CommunitySetExprVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetDifference( CommunitySetDifference communitySetDifference, Configuration arg) { Set<CommunityVar> s1 = communitySetDifference.getInitial().accept(this, arg); Set<CommunityVar> s2 = communitySetDifference .getRemovalCriterion() .accept(new CommunityMatchExprVarCollector(), arg); return ImmutableSet.<CommunityVar>builder().addAll(s1).addAll(s2).build(); }  @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); }
CommunitySetExprVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> { @Override public Set<CommunityVar> visitCommunitySetDifference( CommunitySetDifference communitySetDifference, Configuration arg) { Set<CommunityVar> s1 = communitySetDifference.getInitial().accept(this, arg); Set<CommunityVar> s2 = communitySetDifference .getRemovalCriterion() .accept(new CommunityMatchExprVarCollector(), arg); return ImmutableSet.<CommunityVar>builder().addAll(s1).addAll(s2).build(); }  @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);  }