Applies proc to every vertex which has just been removed or enforced, depending on evt.
@param proc    an incremental procedure over vertices
@param evt    either ENFORCENODE or REMOVENODE
@throws ContradictionException if a failure occurs
357508
public void forEachNode(IntProcedure proc, GraphEventType evt) throws ContradictionException {
		int type;
		if (evt == GraphEventType.REMOVE_NODE) {
			type = GraphDelta.NR;
			for (int i = frozenFirst[type]; i < frozenLast[type]; i++) {
				if (delta.getCause(i, type) != propagator) {
					proc.execute(delta.get(i, type));
				}
			}
		} else if (evt == GraphEventType.ADD_NODE) {
			type = GraphDelta.NE;
			for (int i = frozenFirst[type]; i < frozenLast[type]; i++) {
				if (delta.getCause(i, type) != propagator) {
					proc.execute(delta.get(i, type));
				}
			}
		} else {
			throw new UnsupportedOperationException();
		}
	}
517167
public void eachNonZero(VectorProcedure procedure) {
        VectorIterator it = nonZeroIterator();

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            procedure.apply(i, x);
        }
    }
517832
private void checkAtLeast(int i) throws ContradictionException {
		ISet pot = target.getPotSet(g, i);
		ISet ker = target.getMandSet(g, i);
		int potSize = pot.size();
		if (potSize < degrees[i]) {
			g.removeNode(i, this);
		} else if (potSize == degrees[i] && g.getMandatoryNodes().contains(i) && ker.size() < potSize) {
			for (int s : pot) {
				target.enforce(g, i, s, this);
			}
		}
	}
4876
@Override
	public void propagate(int evtmask) throws ContradictionException {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (g.getMandSuccOrNeighOf(i).contains(j)) {
					matrix[i][j].setToTrue(this);
				} else if (!g.getPotSuccOrNeighOf(i).contains(j)) {
					matrix[i][j].setToFalse(this);
				}
			}
		}
		gdm.unfreeze();
	}
257389
Node tryOptimizeBlock(Node n) {
    // Remove any useless children
    for (Node c = n.getFirstChild(); c != null; ) {
      Node next = c.getNext();  // save c.next, since 'c' may be removed
      if (!isUnremovableNode(c) && !mayHaveSideEffects(c)) {
        checkNormalization(!NodeUtil.isFunctionDeclaration(n), "function declaration");
        // TODO(johnlenz): determine what this is actually removing. Candidates
        //    include: EMPTY nodes, control structures without children
        //    (removing infinite loops), empty try blocks.  What else?
        n.removeChild(c);
        reportChangeToEnclosingScope(n);
        markFunctionsDeleted(c);
      } else {
        tryOptimizeConditionalAfterAssign(c);
      }
      c = next;
    }

    if (n.isSyntheticBlock() || n.isScript() || n.getParent() == null) {
      return n;
    }

    // Try to remove the block.
    Node parent = n.getParent();
    if (NodeUtil.tryMergeBlock(n, false)) {
      reportChangeToEnclosingScope(parent);
      return null;
    }

    return n;
  }
990832
public boolean enforceNode(int x, ICause cause) throws ContradictionException {
		assert cause != null;
		assert (x >= 0 && x < n);
		if (UB.getNodes().contains(x)) {
			if (LB.addNode(x)) {
				if (reactOnModification) {
					delta.add(x, GraphDelta.NE, cause);
				}
				GraphEventType e = GraphEventType.ADD_NODE;
				notifyPropagators(e, cause);
				return true;
			}
			return false;
		}
		this.contradiction(cause, "enforce node which is not in the domain");
		return true;
	}
407655
def condition(proc)
      return unless block_given?
      @template.add_node Nodes::Condition.new(proc, sub_compile(nil, true) { yield })
    end
432479
boolean handleStep(ListIterator<Step<?, ?>> stepIterator, MutableInt pathCount) {
        Step<?, ?> step = stepIterator.next();
        removeTinkerPopLabels(step);
        if (step instanceof GraphStep) {
            doFirst(stepIterator, step, pathCount);
        } else if (this.sqlgStep == null) {
            boolean keepGoing = doFirst(stepIterator, step, pathCount);
            stepIterator.previous();
            return keepGoing;
        } else {
            if (step instanceof VertexStep || step instanceof EdgeVertexStep || step instanceof EdgeOtherVertexStep) {
                handleVertexStep(stepIterator, (AbstractStep<?, ?>) step, pathCount);
            } else if (step instanceof RepeatStep) {
                if (!unoptimizableRepeatStep()) {
                    handleRepeatStep((RepeatStep<?>) step, pathCount);
                } else {
                    this.currentReplacedStep.addLabel((pathCount) + BaseStrategy.PATH_LABEL_SUFFIX + BaseStrategy.SQLG_PATH_FAKE_LABEL);
                    return false;
                }
            } else if (step instanceof OptionalStep) {
                if (!unoptimizableOptionalStep((OptionalStep<?>) step)) {
                    this.optionalStepStack.clear();
                    handleOptionalStep(1, (OptionalStep<?>) step, this.traversal, pathCount);
                    this.optionalStepStack.clear();
                    //after choose steps the optimization starts over in VertexStrategy
                    this.reset = true;
                } else {
                    return false;
                }
            } else if (step instanceof ChooseStep) {
                if (!unoptimizableChooseStep((ChooseStep<?, ?, ?>) step)) {
                    this.chooseStepStack.clear();
                    handleChooseStep(1, (ChooseStep<?, ?, ?>) step, this.traversal, pathCount);
                    this.chooseStepStack.clear();
                    //after choose steps the optimization starts over
                    this.reset = true;
                } else {
                    return false;
                }
            } else if (step instanceof OrderGlobalStep) {
                stepIterator.previous();
                handleOrderGlobalSteps(stepIterator, pathCount);
                handleRangeGlobalSteps(stepIterator, pathCount);
            } else if (step instanceof RangeGlobalStep) {
                handleRangeGlobalSteps(stepIterator, pathCount);
            } else if (step instanceof SelectStep || (step instanceof SelectOneStep)) {
                handleOrderGlobalSteps(stepIterator, pathCount);
                handleRangeGlobalSteps(stepIterator, pathCount);
                //select step can not be followed by a PropertyStep
                if (step instanceof SelectOneStep) {
                    SelectOneStep selectOneStep = (SelectOneStep) step;
                    String key = (String) selectOneStep.getScopeKeys().iterator().next();
                    if (stepIterator.hasNext()) {
                        Step<?, ?> next = stepIterator.next();
                        if (next instanceof PropertiesStep) {
                            //get the step for the label
                            Optional<ReplacedStep<?, ?>> labeledReplacedStep = this.sqlgStep.getReplacedSteps().stream().filter(
                                    r -> {
                                        //Take the first
                                        if (r.hasLabels()) {
                                            String label = r.getLabels().iterator().next();
                                            String stepLabel = SqlgUtil.originalLabel(label);
                                            return stepLabel.equals(key);
                                        } else {
                                            return false;
                                        }
                                    }
                            ).findAny();
                            Preconditions.checkState(labeledReplacedStep.isPresent());
                            ReplacedStep<?, ?> replacedStep = labeledReplacedStep.get();
                            handlePropertiesStep(replacedStep, next);
                            return true;
                        } else {
                            stepIterator.previous();
                            return false;
                        }
                    }
                }
//                return !stepIterator.hasNext() || !(stepIterator.next() instanceof SelectOneStep);
            } else if (step instanceof DropStep && (!this.sqlgGraph.getSqlDialect().isMariaDb())) {

                Traversal.Admin<?, ?> root = TraversalHelper.getRootTraversal(this.traversal);
                final Optional<EventStrategy> eventStrategyOptional = root.getStrategies().getStrategy(EventStrategy.class);
                if (eventStrategyOptional.isPresent()) {
                    //Do nothing, it will go via the SqlgDropStepBarrier.
                } else {
                    //MariaDB does not support target and source together.
                    //Table 'E_ab' is specified twice, both as a target for 'DELETE' and as a separate source for data
                    //This has been fixed in 10.3.1, waiting for it to land in the repo.
                    handleDropStep();
                }
                return false;
            } else if (step instanceof DropStep && this.sqlgGraph.getSqlDialect().isMariaDb()) {
                return false;
            } else if (step instanceof PropertiesStep) {
                return handlePropertiesStep(this.currentReplacedStep, step);
            } else if (step instanceof PropertyMapStep) {
                return handlePropertyMapStep(step);
            } else {
                throw new IllegalStateException("Unhandled step " + step.getClass().getName());
            }
        }
        return true;
    }
1281761
public void performPruning(double UB) throws ContradictionException {
		double delta = UB - treeCost;
		assert delta >= 0;
		fromInterest = 0;
		if (selectAndCompress(delta)) {
			lca.preprocess(cctRoot, ccTree);
			pruning(fromInterest, delta);
		}
	}
966120
private void lagrangianRelaxation() throws ContradictionException {
		int lb = obj.getLB();
		nbSprints = 30;
		if (nbSols != model.getSolver().getSolutionCount()
				|| obj.getUB() < objUB
				|| (firstPropag && !waitFirstSol)) {
			nbSols = model.getSolver().getSolutionCount();
			objUB = obj.getUB();
			convergeAndFilter();
			firstPropag = false;
			g = gV.getUB();
		} else {
			fastRun(2);
		}
		if (lb < obj.getLB()) {
			lagrangianRelaxation();
		}
	}
467950
public void each(VectorProcedure procedure) {
        VectorIterator it = iterator();

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            procedure.apply(i, x);
        }
    }
997833
@Override
	public void propagate(int evtmask) throws ContradictionException {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (matrix[i][j].getLB() == 1) {
					g.enforceArc(i, j, this);
				} else if (matrix[i][j].getUB() == 0) {
					g.removeArc(i, j, this);
				}
			}
		}
	}
818247
function manageProcess(proc, cb) {
  var errorMsg = '';
  proc.stderr.on('data', function(data) {
    errorMsg += data.toString();
  });
  proc.on('close', function(code) {
    cb(code === 0 ? null : { message: errorMsg });
  });
}
614584
@Override
	public void propagate(int evtmask) throws ContradictionException {
		int nbK = 0;
		int nbE = 0;
		ISet env = g.getPotentialNodes();
		for (int i : env) {
			nbE += g.getPotSuccOrNeighOf(i).size();
			nbK += g.getMandSuccOrNeighOf(i).size();
		}
		if (!g.isDirected()) {
			nbK /= 2;
			nbE /= 2;
		}
		filter(nbK, nbE);
	}
482025
@Override
	public void propagate(int evtmask) throws ContradictionException {
		ISet ker = g.getMandatoryNodes();
		ISet succ;
		for (int i : ker) {
			succ = g.getMandSuccOf(i);
			for (int j : succ) {
				g.enforceArc(j, i, this);
			}
		}
		gdm.unfreeze();
	}
981435
Node tryFoldDoAway(Node n) {
    checkArgument(n.isDo());

    Node cond = NodeUtil.getConditionExpression(n);
    if (NodeUtil.getImpureBooleanValue(cond) != TernaryValue.FALSE) {
      return n;
    }

    Node block = NodeUtil.getLoopCodeBlock(n);
    if (n.getParent().isLabel() || hasUnnamedBreakOrContinue(block)) {
      return n;
    }

    Node parent = n.getParent();
    n.replaceWith(block.detach());
    if (mayHaveSideEffects(cond)) {
      Node condStatement = IR.exprResult(cond.detach()).srcref(cond);
      parent.addChildAfter(condStatement, block);
    }
    reportChangeToEnclosingScope(parent);

    return block;
  }
766612
private void checkAtMost(int i) throws ContradictionException {
		ISet ker = target.getMandSet(g, i);
		ISet env = target.getPotSet(g, i);
		int size = ker.size();
		if (size > degrees[i]) {
			g.removeNode(i, this);
		} else if (size == degrees[i] && env.size() > size) {
			for (int other : env) {
				if (!ker.contains(other)) {
					target.remove(g, i, other, this);
				}
			}
		}
	}