コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleOperand"/> class.
        /// </summary>
        /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String,String}"/> containing market specifiers</param>
        /// <param name="operandString">The <see cref="string"/> representation of the operand - i.e. name of the specifier</param>
        /// <param name="operation">A <see cref="SimpleMathOperation"/> specifying the operation</param>
        /// <param name="staticValue">The value to be added to the value of the specifier</param>
        public ExpressionOperand(IReadOnlyDictionary <string, string> specifiers, string operandString, SimpleMathOperation operation, int staticValue)
        {
            Contract.Requires(specifiers != null && specifiers.Any());
            Contract.Requires(!string.IsNullOrEmpty(operandString));
            Contract.Requires(System.Enum.IsDefined(typeof(SimpleMathOperation), operation));

            _specifiers    = specifiers;
            _operandString = operandString;
            _operation     = operation;
            _staticValue   = staticValue;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleOperand"/> class.
        /// </summary>
        /// <param name="specifiers">A <see cref="IReadOnlyDictionary{String,String}"/> containing market specifiers</param>
        /// <param name="operand">The <see cref="string"/> representation of the operand - i.e. name of the specifier</param>
        /// <param name="operation">A <see cref="SimpleMathOperation"/> specifying the operation</param>
        /// <param name="staticValue">The value to be added to the value of the specifier</param>
        public ExpressionOperand(IReadOnlyDictionary <string, string> specifiers, string operand, SimpleMathOperation operation, int staticValue)
        {
            Guard.Argument(specifiers, nameof(specifiers)).NotNull().NotEmpty();
            Guard.Argument(operand, nameof(operand)).NotNull().NotEmpty();
            Guard.Argument(operation, nameof(operation)).Require(Enum.IsDefined(typeof(SimpleMathOperation), operation));

            _specifiers    = specifiers;
            _operandString = operand;
            _operation     = operation;
            _staticValue   = staticValue;
        }