当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionParameters类代码示例

本文整理汇总了C#中ExpressionParameters的典型用法代码示例。如果您正苦于以下问题:C# ExpressionParameters类的具体用法?C# ExpressionParameters怎么用?C# ExpressionParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExpressionParameters类属于命名空间,在下文中一共展示了ExpressionParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            var leftValue = (double)left.Calculate(parameters);
            var rightValue = (double)right.Calculate(parameters);

            return (leftValue == rightValue).AsNumber();
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:15,代码来源:Equal.cs

示例2: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            var leftValue = (double)m_left.Calculate(parameters);
            var rightValue = (double)m_right.Calculate(parameters);

            return leftValue >= rightValue;
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:15,代码来源:GreaterOrEqual.cs

示例3: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            while (right.Calculate(parameters).AsBool())
                left.Calculate(parameters);

            return double.NaN;
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:15,代码来源:While.cs

示例4: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            var var = (Variable)left;
            var newValue = parameters.Parameters[var.Name] - (double)right.Calculate(parameters);
            parameters.Parameters[var.Name] = newValue;

            return newValue;
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:SubAssign.cs

示例5: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            var var = (Variable)argument;
            var newValue = parameters.Parameters[var.Name] + 1;
            parameters.Parameters[var.Name] = newValue;

            return newValue;
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:Inc.cs

示例6: Calculate

 /// <summary>
 /// Calculates this bitwise NOT expression.
 /// </summary>
 /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
 /// <returns>
 /// A result of the calculation.
 /// </returns>
 /// <seealso cref="ExpressionParameters" />
 public override object Calculate(ExpressionParameters parameters)
 {
     #if PORTABLE
     return ~(int)Math.Round((double)argument.Calculate(parameters));
     #else
     return ~(int)Math.Round((double)argument.Calculate(parameters), MidpointRounding.AwayFromZero);
     #endif
 }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:16,代码来源:Not.cs

示例7: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            if (parameters == null || parameters.AngleMeasurement == AngleMeasurement.Degree)
                return CalculateDergee(parameters);
            if (parameters.AngleMeasurement == AngleMeasurement.Radian)
                return CalculateRadian(parameters);
            if (parameters.AngleMeasurement == AngleMeasurement.Gradian)
                return CalculateGradian(parameters);

            return double.NaN;
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:19,代码来源:TrigonometricExpression.cs

示例8: Calculate

        /// <summary>
        /// Calculates this mathemarical expression.
        /// </summary>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// A result of the calculation.
        /// </returns>
        /// <seealso cref="ExpressionParameters" />
        public override object Calculate(ExpressionParameters parameters)
        {
            var var = (Variable)m_argument;
            var parameter = var.Calculate(parameters);
            if (parameter is bool)
                throw new NotSupportedException();

            var newValue = Convert.ToDouble(parameter) - 1;
            parameters.Parameters[var.Name] = newValue;

            return newValue;
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:20,代码来源:Dec.cs

示例9: Add

        /// <summary>
        /// Adds the <paramref name="right"/> vector to the <paramref name="left"/> vector.
        /// </summary>
        /// <param name="left">The left vector.</param>
        /// <param name="right">The right vector.</param>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>The sum of matrices.</returns>
        /// <exception cref="System.ArgumentException">The size of matrices is invalid.</exception>
        public static Vector Add(this Vector left, Vector right, ExpressionParameters parameters)
        {
            if (left.ParametersCount != right.ParametersCount)
                throw new ArgumentException(Resource.MatrixArgException);

            var exps = new IExpression[left.ParametersCount];

            Parallel.For(0, left.ParametersCount,
                i => exps[i] = new Number((double)left.Arguments[i].Execute(parameters) + (double)right.Arguments[i].Execute(parameters))
            );

            return new Vector(exps);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:21,代码来源:MatrixExtentions.cs

示例10: Add

        /// <summary>
        /// Adds the <paramref name="right"/> vector to the <paramref name="left"/> vector.
        /// </summary>
        /// <param name="left">The left vector.</param>
        /// <param name="right">The right vector.</param>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>The sum of matrices.</returns>
        /// <exception cref="System.ArgumentException">The size of matrices is invalid.</exception>
        public static Vector Add(this Vector left, Vector right, ExpressionParameters parameters)
        {
            if (left.ParametersCount != right.ParametersCount)
                throw new ArgumentException(Resource.MatrixArgException);

            var exps = new IExpression[left.ParametersCount];
            #if NET40_OR_GREATER
            Parallel.For(0, left.ParametersCount,
                i => exps[i] = new Number((double)left.Arguments[i].Calculate(parameters) + (double)right.Arguments[i].Calculate(parameters))
            );
            #else
            for (int i = 0; i < left.ParametersCount; i++)
                exps[i] = new Number((double)left.Arguments[i].Calculate(parameters) + (double)right.Arguments[i].Calculate(parameters));
            #endif

            return new Vector(exps);
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:25,代码来源:MatrixExtentions.cs

示例11: Mul

        /// <summary>
        /// Multiplies the <paramref name="left" /> vector by the <paramref name="right" /> matrix.
        /// </summary>
        /// <param name="left">The left vector.</param>
        /// <param name="right">The right matrix.</param>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>
        /// The product of matrices.
        /// </returns>
        /// <exception cref="System.ArgumentException">The size of matrices is invalid.</exception>
        public static Matrix Mul(this Vector left, Matrix right, ExpressionParameters parameters)
        {
            var matrix = new Matrix(new[] { left });

            return matrix.Mul(right, parameters);
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:16,代码来源:MatrixExtentions.cs

示例12: LUPDecomposition

        /// <summary>
        /// Decomposes a matrix.
        /// </summary>
        /// <param name="matrix">The matrix.</param>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <param name="permutation">An array of permutations.</param>
        /// <param name="toggle">Used for calculating a determinant.</param>
        /// <returns>Combined Lower and Upper matrices.</returns>
        public static Matrix LUPDecomposition(this Matrix matrix, ExpressionParameters parameters, out int[] permutation, out int toggle)
        {
            if (!matrix.IsSquare)
                throw new ArgumentException(Resource.MatrixArgException);

            var result = LUPDecomposition_(matrix.ToCalculatedArray(parameters), out permutation, out toggle);
            var m = new Matrix(result.Length, result.Length);
            for (int i = 0; i < result.Length; i++)
                for (int j = 0; j < result.Length; j++)
                    m[i][j] = new Number(result[i][j]);

            return m;
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:21,代码来源:MatrixExtentions.cs

示例13: Inverse

        /// <summary>
        /// Inverts a matrix.
        /// </summary>
        /// <param name="matrix">The matrix.</param>
        /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
        /// <returns>An inverse matrix.</returns>
        public static Matrix Inverse(this Matrix matrix, ExpressionParameters parameters)
        {
            if (!matrix.IsSquare)
                throw new ArgumentException(Resource.MatrixArgException);

            var size = matrix.ParametersCount;
            var result = Inverse_(matrix.ToCalculatedArray(parameters));
            var m = new Matrix(size, size);
            for (int i = 0; i < size; i++)
                for (int j = 0; j < size; j++)
                    m[i][j] = new Number(result[i][j]);

            return m;
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:20,代码来源:MatrixExtentions.cs

示例14: CalculateGradian

 /// <summary>
 /// Calculates this mathemarical expression (using gradian).
 /// </summary>
 /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
 /// <returns>
 /// A result of the calculation.
 /// </returns>
 /// <seealso cref="ExpressionParameters" />
 protected override double CalculateGradian(ExpressionParameters parameters)
 {
     return MathExtentions.Asec((double)m_argument.Calculate(parameters)) / Math.PI * 200;
 }
开发者ID:smwentum,项目名称:xFunc,代码行数:12,代码来源:Arcsec.cs

示例15: Calculate

 /// <summary>
 /// Calculates this mathemarical expression.
 /// </summary>
 /// <param name="parameters">An object that contains all parameters and functions for expressions.</param>
 /// <returns>
 /// A result of the calculation.
 /// </returns>
 /// <seealso cref="ExpressionParameters" />
 public override object Calculate(ExpressionParameters parameters)
 {
     return MathExtentions.Acsch((double)m_argument.Calculate(parameters));
 }
开发者ID:smwentum,项目名称:xFunc,代码行数:12,代码来源:Arcsch.cs


注:本文中的ExpressionParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。