@Test public void testEraseAndSet() { BDD setBdd = dstIp("1.1.1.1"); BDD vars = Arrays.stream(PKT.getDstIp().getBitvec()).reduce(PKT.getFactory().one(), BDD::and); Transition transition = new EraseAndSet(vars, setBdd); assertThat(transition.transitForward(ONE), equalTo(setBdd)); assertThat(transition.transitBackward(ONE), equalTo(ONE)); assertThat(transition.transitForward(setBdd), equalTo(setBdd)); assertThat(transition.transitBackward(setBdd), equalTo(ONE)); assertThat(transition.transitForward(setBdd.not()), equalTo(setBdd)); assertThat(transition.transitBackward(setBdd.not()), equalTo(ZERO)); BDD bdd = setBdd.ite(srcIp("5.5.5.5"), srcIp("6.6.6.6")); assertThat( transition.transitForward(bdd), equalTo(setBdd.and(srcIp("5.5.5.5").or(srcIp("6.6.6.6"))))); assertThat(transition.transitBackward(bdd), equalTo(srcIp("5.5.5.5"))); }
EraseAndSet(BDD eraseVars, BDD setValue) { checkArgument(!setValue.isZero(), "Value is zero BDD. Use ZERO instead"); checkArgument( (!eraseVars.isOne() && !eraseVars.isZero()), "No variables to erase. Use Constraint instead"); _eraseVars = eraseVars; _setValue = setValue; }
EraseAndSet implements Transition { EraseAndSet(BDD eraseVars, BDD setValue) { checkArgument(!setValue.isZero(), "Value is zero BDD. Use ZERO instead"); checkArgument( (!eraseVars.isOne() && !eraseVars.isZero()), "No variables to erase. Use Constraint instead"); _eraseVars = eraseVars; _setValue = setValue; } }
EraseAndSet implements Transition { EraseAndSet(BDD eraseVars, BDD setValue) { checkArgument(!setValue.isZero(), "Value is zero BDD. Use ZERO instead"); checkArgument( (!eraseVars.isOne() && !eraseVars.isZero()), "No variables to erase. Use Constraint instead"); _eraseVars = eraseVars; _setValue = setValue; } EraseAndSet(BDD eraseVars, BDD setValue); }
EraseAndSet implements Transition { EraseAndSet(BDD eraseVars, BDD setValue) { checkArgument(!setValue.isZero(), "Value is zero BDD. Use ZERO instead"); checkArgument( (!eraseVars.isOne() && !eraseVars.isZero()), "No variables to erase. Use Constraint instead"); _eraseVars = eraseVars; _setValue = setValue; } EraseAndSet(BDD eraseVars, BDD setValue); @Override boolean equals(Object o); @Override int hashCode(); @Override BDD transitForward(BDD bdd); @Override BDD transitBackward(BDD bdd); @Override String toString(); }
EraseAndSet implements Transition { EraseAndSet(BDD eraseVars, BDD setValue) { checkArgument(!setValue.isZero(), "Value is zero BDD. Use ZERO instead"); checkArgument( (!eraseVars.isOne() && !eraseVars.isZero()), "No variables to erase. Use Constraint instead"); _eraseVars = eraseVars; _setValue = setValue; } EraseAndSet(BDD eraseVars, BDD setValue); @Override boolean equals(Object o); @Override int hashCode(); @Override BDD transitForward(BDD bdd); @Override BDD transitBackward(BDD bdd); @Override String toString();  }