コード例 #1
0
        public SpiceEvaluationContext(
            string name,
            SpiceExpressionMode mode,
            ISpiceNetlistCaseSensitivitySettings caseSetting,
            IRandomizer randomizer,
            IExpressionParserFactory expressionParserFactory,
            IExpressionFeaturesReader expressionFeaturesReader,
            IExpressionValueProvider expressionValueProvider,
            INameGenerator nameGenerator,
            IResultService resultService)

            : base(name,
                   caseSetting,
                   randomizer,
                   expressionParserFactory,
                   expressionFeaturesReader,
                   expressionValueProvider,
                   nameGenerator,
                   resultService)
        {
            Mode = mode;
            CreateCommonFunctions();
            CreateSpiceFunctions();
            CreateSpiceParameters();
        }
コード例 #2
0
 public EvaluationContext(
     string name,
     ISpiceNetlistCaseSensitivitySettings caseSettings,
     IRandomizer randomizer,
     IExpressionParserFactory expressionParserFactory,
     IExpressionFeaturesReader expressionFeaturesReader,
     IExpressionValueProvider expressionValueProvider,
     INameGenerator nameGenerator,
     IResultService resultService)
 {
     _caseSettings            = caseSettings;
     ExpressionParserFactory  = expressionParserFactory;
     ExpressionFeaturesReader = expressionFeaturesReader;
     ExpressionValueProvider  = expressionValueProvider;
     NameGenerator            = nameGenerator;
     ResultService            = resultService;
     Name               = name;
     Parameters         = new Dictionary <string, Expression>(StringComparerProvider.Get(caseSettings.IsParameterNameCaseSensitive));
     Arguments          = new Dictionary <string, Expression>(StringComparerProvider.Get(caseSettings.IsParameterNameCaseSensitive));
     Functions          = new Dictionary <string, List <IFunction> >(StringComparerProvider.Get(caseSettings.IsFunctionNameCaseSensitive));
     Children           = new List <EvaluationContext>();
     ExpressionRegistry = new ExpressionRegistry(caseSettings.IsParameterNameCaseSensitive, caseSettings.IsExpressionNameCaseSensitive);
     FunctionsBody      = new Dictionary <string, string>();
     FunctionArguments  = new Dictionary <string, List <string> >();
     Randomizer         = randomizer;
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MathExpressionCompiler" /> class.
        /// </summary>
        /// <param name="charComparer">The character comparer.</param>
        /// <param name="parserFactory">The parser factory.</param>
        public MathExpressionCompiler(IEqualityComparer <char> charComparer, IExpressionParserFactory parserFactory)
        {
            charComparer ??= CharComparer.Ordinal;
            var comparer = new SourceCodeFragmentContentComparer(charComparer);

            _functionsByNameByArgCount = new Dictionary <IReadOnlyList <char>, Dictionary <int, Func <object[], object> > >(comparer);

            _variables = new Dictionary <IReadOnlyList <char>, Func <object> >(comparer);
            _constants = new Dictionary <IReadOnlyList <char>, object>(comparer);

            _parser = parserFactory.Create(this, this, charComparer);
        }
コード例 #4
0
 public ExpressionValueProvider(IExpressionParserFactory parserFactory)
 {
     _parserFactory = parserFactory;
 }
コード例 #5
0
 public ExpressionFeaturesReader(IExpressionParserFactory factory)
 {
     _factory = factory;
 }