Example #1
0
        /// <summary>
        ///   Returns a string that represents the current object.
        /// </summary>
        public override string ToString()
        {
            var visitor = new ToStringVisitor();

            visitor.Visit(this);
            return(visitor.FormulaString);
        }
        /// <summary>
        ///   Gets the string representation of the formula.
        /// </summary>
        public static string FormulaToString(Formula formula)
        {
            var visitor = new ToStringVisitor();

            visitor.Visit(formula);
            return(visitor.FormulaString);
        }
Example #3
0
        private bool TryToFindFormulaInFormulasToCheck(Formula formula)
        {
            var formulaAsString = ToStringVisitor.FormulaToString(formula);

            if (_formulasToCheckIndex.ContainsKey(formulaAsString))
            {
                var indexOfStateFormula = _formulasToCheckIndex[formulaAsString];
                CheckIfIndexIsCorrect(formula, indexOfStateFormula);
                SetExpressionToIndex(indexOfStateFormula);
                return(true);
            }
            return(false);
        }
Example #4
0
        public StateFormulaSetEvaluatorCompilationVisitor2(Formula[] formulasToCheck)
        {
            _formulasToCheck         = formulasToCheck;
            LabelsOfCurrentStateExpr = Expression.Parameter(typeof(StateFormulaSet), "labelsOfCurrentState");

            for (var i = 0; i < _formulasToCheck.Length; i++)
            {
                var formulaAsString = ToStringVisitor.FormulaToString(_formulasToCheck[i]);
                if (!_formulasToCheckIndex.ContainsKey(formulaAsString))
                {
                    _formulasToCheckIndex.Add(formulaAsString, i);
                }
                else
                {
                    SameFormulaGetsEvaluatedMoreOften();
                }
            }
        }