private bool ForEachConstraintRecursively(IFunction4 block) { IQueue4 queue = new NoDuplicatesQueue(new NonblockingQueue()); IEnumerator constrIter = IterateConstraints(); while (constrIter.MoveNext()) { queue.Add(constrIter.Current); } while (queue.HasNext()) { QCon constr = (QCon)queue.Next(); bool cancel = (bool)block.Apply(constr); if (cancel) { return(true); } IEnumerator childIter = constr.IterateChildren(); while (childIter.MoveNext()) { queue.Add(childIter.Current); } IEnumerator joinIter = constr.IterateJoins(); while (joinIter.MoveNext()) { queue.Add(joinIter.Current); } } return(false); }
public object Apply(object obj) { QCon constr = (QCon)obj; IEnumerator joinIter = constr.IterateJoins(); while (joinIter.MoveNext()) { QConJoin join = (QConJoin)joinIter.Current; if (join.IsOr()) { return(true); } } return(false); }
private void CollectTopLevelJoins(Collection4 joins, QCon constraintWithJoins) { IEnumerator i = constraintWithJoins.IterateJoins(); while (i.MoveNext()) { QConJoin join = (QConJoin)i.Current; if (!join.HasJoins()) { if (!joins.ContainsByIdentity(join)) { joins.Add(join); } } else { CollectTopLevelJoins(joins, join); } } }