private void AddDeepestOnceFormulas() { var alreadyKnownLabels = FinalStateFormulaLabels.ToArray(); var onceFormulaCollector = new CollectDeepestOnceFormulasWithCompilableOperandVisitor(); foreach (var formula in _formulasToCheck) { onceFormulaCollector.VisitNewTopLevelFormula(formula); } var deepestOnceFormulas = onceFormulaCollector.DeepestOnceFormulasWithCompilableOperand.ToArray(); if (deepestOnceFormulas.Length > 0) { var formulasToObserve = deepestOnceFormulas.Select(formula => formula.Operand).ToArray(); Func <ObserveFormulasModifier> observeFormulasModifier = () => new ObserveFormulasModifier(alreadyKnownLabels, formulasToObserve); _transitionModifierGenerators.Add(observeFormulasModifier); } foreach (var formula in deepestOnceFormulas) { Assert.That(formula.Operator == UnaryOperator.Once, "operator of OnceFormula must be Once"); _finalStateFormulas.Add(formula); _labelsOfKnownFormulas.Add(formula.Label); } }
public void AddTerminateEarlyFormula() { if (!_configuration.EnableEarlyTermination) { return; } if (_formulasToCheck.Count != 1) { return; } var terminateEarlyFormula = ExtractTerminateEarlyFromFormula(_formulasToCheck.First()); if (terminateEarlyFormula == null) { return; } NeedsStutteringState = true; // This method also succeeds with Once formulas, when those Once formulas have been normalized (i.e. a observeFormulasModifier exists) var terminateEarlyFunc = StateFormulaSetEvaluatorCompilationVisitor.Compile(FinalStateFormulaLabels.ToArray(), terminateEarlyFormula); _transitionModifierGenerators.Add(() => new EarlyTerminationModifier(terminateEarlyFunc)); }