@Test public void testSwap() { BDDPacket pkt = new BDDPacket(); BDDInteger dstIp = pkt.getDstIp(); BDDInteger srcIp = pkt.getSrcIp(); BDDInteger dstPort = pkt.getDstPort(); Ip ip1 = Ip.parse("1.1.1.1"); Ip ip2 = Ip.parse("2.2.2.2"); Ip ip3 = Ip.parse("3.3.3.3"); Ip ip4 = Ip.parse("4.4.4.4"); BiFunction<BDDInteger, BDDInteger, BDD> mkBdd = (v1, v2) -> (v1.value(ip1.asLong()).and(v2.value(ip2.asLong())).and(dstPort.value(0))) .or(v1.value(ip3.asLong()).and(v2.value(ip4.asLong())).and(dstIp.value(1))); BDD orig = mkBdd.apply(dstIp, srcIp); BDD swapped = mkBdd.apply(srcIp, dstIp); assertThat(swap(orig, dstIp, srcIp), equalTo(swapped)); }
public static BDD swap(BDD bdd, BDDInteger... vars) { return bdd.replace(swapPairing(vars)); }
BDDUtils { public static BDD swap(BDD bdd, BDDInteger... vars) { return bdd.replace(swapPairing(vars)); } }
BDDUtils { public static BDD swap(BDD bdd, BDDInteger... vars) { return bdd.replace(swapPairing(vars)); }  }
BDDUtils { public static BDD swap(BDD bdd, BDDInteger... vars) { return bdd.replace(swapPairing(vars)); }  static BDDFactory bddFactory(int numVariables); static BDD swap(BDD bdd, BDDInteger... vars); static BDDPairing swapPairing(BDDInteger... vars); }
BDDUtils { public static BDD swap(BDD bdd, BDDInteger... vars) { return bdd.replace(swapPairing(vars)); }  static BDDFactory bddFactory(int numVariables); static BDD swap(BDD bdd, BDDInteger... vars); static BDDPairing swapPairing(BDDInteger... vars);  }