@Test public void testIpWildcardSetIpSpace() { Prefix include1 = Prefix.parse("1.1.1.0/24"); Prefix include2 = Prefix.parse("1.1.2.0/24"); Prefix include3 = Prefix.parse("1.1.3.0/24"); Prefix exclude1 = Prefix.parse("1.1.0.0/16"); Prefix exclude2 = Prefix.parse("1.1.1.1/32"); Prefix exclude3 = Prefix.parse("1.1.2.2/32"); Prefix exclude4 = Prefix.parse("1.1.3.3/32"); IpWildcardSetIpSpace ipSpace = IpWildcardSetIpSpace.builder() .including(IpWildcard.create(include1)) .including(IpWildcard.create(include2)) .including(IpWildcard.create(include3)) .excluding(IpWildcard.create(exclude1)) .excluding(IpWildcard.create(exclude2)) .excluding(IpWildcard.create(exclude3)) .excluding(IpWildcard.create(exclude4)) .build(); BDD include1Bdd = _ipSpaceToBdd.toBDD(include1); BDD include2Bdd = _ipSpaceToBdd.toBDD(include2); BDD include3Bdd = _ipSpaceToBdd.toBDD(include3); BDD exclude1Bdd = _ipSpaceToBdd.toBDD(exclude1); BDD exclude2Bdd = _ipSpaceToBdd.toBDD(exclude2); BDD exclude3Bdd = _ipSpaceToBdd.toBDD(exclude3); BDD exclude4Bdd = _ipSpaceToBdd.toBDD(exclude4); BDD expected = include1Bdd .or(include2Bdd) .or(include3Bdd) .diff(exclude1Bdd) .diff(exclude2Bdd) .diff(exclude3Bdd) .diff(exclude4Bdd); BDD actual = _ipSpaceToBdd.visit(ipSpace); assertEquals(expected, actual); }
public BDD toBDD(Ip ip) { return firstBitsEqual(ip, Prefix.MAX_PREFIX_LENGTH); }
IpSpaceToBDD implements GenericIpSpaceVisitor<BDD> { public BDD toBDD(Ip ip) { return firstBitsEqual(ip, Prefix.MAX_PREFIX_LENGTH); } }
IpSpaceToBDD implements GenericIpSpaceVisitor<BDD> { public BDD toBDD(Ip ip) { return firstBitsEqual(ip, Prefix.MAX_PREFIX_LENGTH); } IpSpaceToBDD(BDDInteger var);  IpSpaceToBDD(BDDInteger var, Map<String, IpSpace> namedIpSpaces); }
IpSpaceToBDD implements GenericIpSpaceVisitor<BDD> { public BDD toBDD(Ip ip) { return firstBitsEqual(ip, Prefix.MAX_PREFIX_LENGTH); } IpSpaceToBDD(BDDInteger var);  IpSpaceToBDD(BDDInteger var, Map<String, IpSpace> namedIpSpaces); @Override BDD castToGenericIpSpaceVisitorReturnType(Object o); BDDInteger getBDDInteger(); BDD toBDD(Ip ip); BDD toBDD(IpWildcard ipWildcard); @Override BDD visitAclIpSpace(AclIpSpace aclIpSpace); @Override BDD visitEmptyIpSpace(EmptyIpSpace emptyIpSpace); @Override BDD visitIpIpSpace(IpIpSpace ipIpSpace); @Override BDD visitIpWildcardIpSpace(IpWildcardIpSpace ipWildcardIpSpace); @Override BDD visitIpSpaceReference(IpSpaceReference ipSpaceReference); @Override BDD visitIpWildcardSetIpSpace(IpWildcardSetIpSpace ipWildcardSetIpSpace); @Override BDD visitPrefixIpSpace(PrefixIpSpace prefixIpSpace); BDD toBDD(Prefix prefix); @Override BDD visitUniverseIpSpace(UniverseIpSpace universeIpSpace); }
IpSpaceToBDD implements GenericIpSpaceVisitor<BDD> { public BDD toBDD(Ip ip) { return firstBitsEqual(ip, Prefix.MAX_PREFIX_LENGTH); } IpSpaceToBDD(BDDInteger var);  IpSpaceToBDD(BDDInteger var, Map<String, IpSpace> namedIpSpaces); @Override BDD castToGenericIpSpaceVisitorReturnType(Object o); BDDInteger getBDDInteger(); BDD toBDD(Ip ip); BDD toBDD(IpWildcard ipWildcard); @Override BDD visitAclIpSpace(AclIpSpace aclIpSpace); @Override BDD visitEmptyIpSpace(EmptyIpSpace emptyIpSpace); @Override BDD visitIpIpSpace(IpIpSpace ipIpSpace); @Override BDD visitIpWildcardIpSpace(IpWildcardIpSpace ipWildcardIpSpace); @Override BDD visitIpSpaceReference(IpSpaceReference ipSpaceReference); @Override BDD visitIpWildcardSetIpSpace(IpWildcardSetIpSpace ipWildcardSetIpSpace); @Override BDD visitPrefixIpSpace(PrefixIpSpace prefixIpSpace); BDD toBDD(Prefix prefix); @Override BDD visitUniverseIpSpace(UniverseIpSpace universeIpSpace);  }