@Test public void testBranch() { BDD guard = dstIp("1.2.3.4"); BDD trueBranchBdd = srcIp("3.3.3.3"); BDD falseBranchBdd = srcIp("4.4.4.4"); Transition trueBranch = new Constraint(trueBranchBdd); Transition falseBranch = new Constraint(falseBranchBdd); Transition transition = new Branch(guard, trueBranch, falseBranch); assertThat(transition.transitForward(ONE), equalTo(guard.ite(trueBranchBdd, falseBranchBdd))); assertThat(transition.transitBackward(ONE), equalTo(guard.ite(trueBranchBdd, falseBranchBdd))); assertThat(transition.transitForward(ZERO), equalTo(ZERO)); assertThat(transition.transitBackward(ZERO), equalTo(ZERO)); assertThat(transition.transitForward(guard), equalTo(guard.and(trueBranchBdd))); assertThat(transition.transitBackward(guard), equalTo(guard.and(trueBranchBdd))); assertThat(transition.transitForward(guard.not()), equalTo(guard.not().and(falseBranchBdd))); assertThat(transition.transitBackward(guard.not()), equalTo(guard.not().and(falseBranchBdd))); }
Branch(BDD guard, Transition trueBranch, Transition falseBranch) { checkArgument(!guard.isZero() && !guard.isOne(), "guard cannot be zero or one."); _guard = guard; _trueBranch = trueBranch; _falseBranch = falseBranch; }
Branch implements Transition { Branch(BDD guard, Transition trueBranch, Transition falseBranch) { checkArgument(!guard.isZero() && !guard.isOne(), "guard cannot be zero or one."); _guard = guard; _trueBranch = trueBranch; _falseBranch = falseBranch; } }
Branch implements Transition { Branch(BDD guard, Transition trueBranch, Transition falseBranch) { checkArgument(!guard.isZero() && !guard.isOne(), "guard cannot be zero or one."); _guard = guard; _trueBranch = trueBranch; _falseBranch = falseBranch; } Branch(BDD guard, Transition trueBranch, Transition falseBranch); }
Branch implements Transition { Branch(BDD guard, Transition trueBranch, Transition falseBranch) { checkArgument(!guard.isZero() && !guard.isOne(), "guard cannot be zero or one."); _guard = guard; _trueBranch = trueBranch; _falseBranch = falseBranch; } Branch(BDD guard, Transition trueBranch, Transition falseBranch); @Override BDD transitForward(BDD bdd); @Override BDD transitBackward(BDD bdd); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
Branch implements Transition { Branch(BDD guard, Transition trueBranch, Transition falseBranch) { checkArgument(!guard.isZero() && !guard.isOne(), "guard cannot be zero or one."); _guard = guard; _trueBranch = trueBranch; _falseBranch = falseBranch; } Branch(BDD guard, Transition trueBranch, Transition falseBranch); @Override BDD transitForward(BDD bdd); @Override BDD transitBackward(BDD bdd); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }