@Test public void testTryMergeDisjuncts_EraseAndSet_EraseAndSet_DiffVars() { BDD v0 = var(0); BDD v1 = var(1); EraseAndSet t1 = new EraseAndSet(v0, v0); EraseAndSet t2 = new EraseAndSet(v1, v1); assertNull(tryMergeDisjuncts(t1, t2)); }
@VisibleForTesting static Transition tryMergeDisjuncts(Transition t1, Transition t2) { if (t1 == IDENTITY && t2 instanceof Constraint) { return t1; } if (t1 instanceof Constraint && t2 == IDENTITY) { return t2; } if (t1 instanceof Constraint && t2 instanceof Constraint) { Constraint c1 = (Constraint) t1; Constraint c2 = (Constraint) t2; return constraint(c1.getConstraint().or(c2.getConstraint())); } if (t1 instanceof EraseAndSet && t2 instanceof EraseAndSet) { EraseAndSet eas1 = (EraseAndSet) t1; EraseAndSet eas2 = (EraseAndSet) t2; BDD vars1 = eas1.getEraseVars(); BDD vars2 = eas2.getEraseVars(); BDD val1 = eas1.getSetValue(); BDD val2 = eas2.getSetValue(); if (vars1.equals(vars2)) { return eraseAndSet(vars1, val1.or(val2)); } } return null; }
Transitions { @VisibleForTesting static Transition tryMergeDisjuncts(Transition t1, Transition t2) { if (t1 == IDENTITY && t2 instanceof Constraint) { return t1; } if (t1 instanceof Constraint && t2 == IDENTITY) { return t2; } if (t1 instanceof Constraint && t2 instanceof Constraint) { Constraint c1 = (Constraint) t1; Constraint c2 = (Constraint) t2; return constraint(c1.getConstraint().or(c2.getConstraint())); } if (t1 instanceof EraseAndSet && t2 instanceof EraseAndSet) { EraseAndSet eas1 = (EraseAndSet) t1; EraseAndSet eas2 = (EraseAndSet) t2; BDD vars1 = eas1.getEraseVars(); BDD vars2 = eas2.getEraseVars(); BDD val1 = eas1.getSetValue(); BDD val2 = eas2.getSetValue(); if (vars1.equals(vars2)) { return eraseAndSet(vars1, val1.or(val2)); } } return null; } }
Transitions { @VisibleForTesting static Transition tryMergeDisjuncts(Transition t1, Transition t2) { if (t1 == IDENTITY && t2 instanceof Constraint) { return t1; } if (t1 instanceof Constraint && t2 == IDENTITY) { return t2; } if (t1 instanceof Constraint && t2 instanceof Constraint) { Constraint c1 = (Constraint) t1; Constraint c2 = (Constraint) t2; return constraint(c1.getConstraint().or(c2.getConstraint())); } if (t1 instanceof EraseAndSet && t2 instanceof EraseAndSet) { EraseAndSet eas1 = (EraseAndSet) t1; EraseAndSet eas2 = (EraseAndSet) t2; BDD vars1 = eas1.getEraseVars(); BDD vars2 = eas2.getEraseVars(); BDD val1 = eas1.getSetValue(); BDD val2 = eas2.getSetValue(); if (vars1.equals(vars2)) { return eraseAndSet(vars1, val1.or(val2)); } } return null; } private  Transitions(); }
Transitions { @VisibleForTesting static Transition tryMergeDisjuncts(Transition t1, Transition t2) { if (t1 == IDENTITY && t2 instanceof Constraint) { return t1; } if (t1 instanceof Constraint && t2 == IDENTITY) { return t2; } if (t1 instanceof Constraint && t2 instanceof Constraint) { Constraint c1 = (Constraint) t1; Constraint c2 = (Constraint) t2; return constraint(c1.getConstraint().or(c2.getConstraint())); } if (t1 instanceof EraseAndSet && t2 instanceof EraseAndSet) { EraseAndSet eas1 = (EraseAndSet) t1; EraseAndSet eas2 = (EraseAndSet) t2; BDD vars1 = eas1.getEraseVars(); BDD vars2 = eas2.getEraseVars(); BDD val1 = eas1.getSetValue(); BDD val2 = eas2.getSetValue(); if (vars1.equals(vars2)) { return eraseAndSet(vars1, val1.or(val2)); } } return null; } private  Transitions(); static Transition branch(BDD guard, Transition thn, Transition els); static Transition compose(Transition... transitions); static @Nullable Transition mergeComposed(Transition t1, Transition t2); static Transition constraint(BDD bdd); static Transition eraseAndSet(BDD var, BDD value); static Transition eraseAndSet(BDDInteger var, BDD value); @Deprecated static Transition or(); static Transition or(Transition... transitions); static Transition addLastHopConstraint(
      @Nullable LastHopOutgoingInterfaceManager mgr,
      String sendingNode,
      String sendingIface,
      String recvNode,
      String recvIface); static Transition addNoLastHopConstraint(
      @Nullable LastHopOutgoingInterfaceManager mgr, String recvNode, String recvIface); static Transition addOutgoingOriginalFlowFiltersConstraint(
      BDDOutgoingOriginalFlowFilterManager mgr); static Transition addOriginatingFromDeviceConstraint(BDDSourceManager mgr); static Transition addSourceInterfaceConstraint(BDDSourceManager mgr, String iface); static Transition removeNodeSpecificConstraints(
      String node,
      @Nullable LastHopOutgoingInterfaceManager lastHopMgr,
      BDDOutgoingOriginalFlowFilterManager originalFlowFilterMgr,
      BDDSourceManager sourceMgr); @VisibleForTesting static Transition removeOutgoingInterfaceConstraints(
      BDDOutgoingOriginalFlowFilterManager mgr); @VisibleForTesting static Transition removeSourceConstraint(BDDSourceManager mgr); static Transition reverse(Transition transition); }
Transitions { @VisibleForTesting static Transition tryMergeDisjuncts(Transition t1, Transition t2) { if (t1 == IDENTITY && t2 instanceof Constraint) { return t1; } if (t1 instanceof Constraint && t2 == IDENTITY) { return t2; } if (t1 instanceof Constraint && t2 instanceof Constraint) { Constraint c1 = (Constraint) t1; Constraint c2 = (Constraint) t2; return constraint(c1.getConstraint().or(c2.getConstraint())); } if (t1 instanceof EraseAndSet && t2 instanceof EraseAndSet) { EraseAndSet eas1 = (EraseAndSet) t1; EraseAndSet eas2 = (EraseAndSet) t2; BDD vars1 = eas1.getEraseVars(); BDD vars2 = eas2.getEraseVars(); BDD val1 = eas1.getSetValue(); BDD val2 = eas2.getSetValue(); if (vars1.equals(vars2)) { return eraseAndSet(vars1, val1.or(val2)); } } return null; } private  Transitions(); static Transition branch(BDD guard, Transition thn, Transition els); static Transition compose(Transition... transitions); static @Nullable Transition mergeComposed(Transition t1, Transition t2); static Transition constraint(BDD bdd); static Transition eraseAndSet(BDD var, BDD value); static Transition eraseAndSet(BDDInteger var, BDD value); @Deprecated static Transition or(); static Transition or(Transition... transitions); static Transition addLastHopConstraint(
      @Nullable LastHopOutgoingInterfaceManager mgr,
      String sendingNode,
      String sendingIface,
      String recvNode,
      String recvIface); static Transition addNoLastHopConstraint(
      @Nullable LastHopOutgoingInterfaceManager mgr, String recvNode, String recvIface); static Transition addOutgoingOriginalFlowFiltersConstraint(
      BDDOutgoingOriginalFlowFilterManager mgr); static Transition addOriginatingFromDeviceConstraint(BDDSourceManager mgr); static Transition addSourceInterfaceConstraint(BDDSourceManager mgr, String iface); static Transition removeNodeSpecificConstraints(
      String node,
      @Nullable LastHopOutgoingInterfaceManager lastHopMgr,
      BDDOutgoingOriginalFlowFilterManager originalFlowFilterMgr,
      BDDSourceManager sourceMgr); @VisibleForTesting static Transition removeOutgoingInterfaceConstraints(
      BDDOutgoingOriginalFlowFilterManager mgr); @VisibleForTesting static Transition removeSourceConstraint(BDDSourceManager mgr); static Transition reverse(Transition transition); static final Transition IDENTITY; static final Transition ZERO; }