Пример #1
0
        /// <summary>
        /// Multiplies the given format string automaton onto an automaton representing allowed format strings for a given set of arguments.
        /// </summary>
        /// <param name="format">The automaton representing format strings.</param>
        /// <param name="argNames">The list of format string arguments.</param>
        /// <returns>The multiplication results.</returns>
        private static StringAutomaton GetValidatedFormatString(StringAutomaton format, IReadOnlyList <string> argNames)
        {
            Debug.Assert(argNames.Count > 0, "The code below relies on at least one argument being provided.");

            var result = new StringAutomaton();

            for (int i = 0; i < argNames.Count; ++i)
            {
                StringAutomaton validatingAutomaton = GetArgumentValidatingAutomaton(i, argNames);
                result.SetToProduct(i == 0 ? format : result, validatingAutomaton);
                result.ClearGroups();
                result.TrySetToConstantOnSupportOfLog(0.0, result);
            }

            return(result);
        }