Пример #1
0
        public override object Evaluate()
        {
            double x = FirstExpression.EvaluateAsReal();
            double y = SecondExpression.EvaluateAsReal();
            double z = ThirdExpression.EvaluateAsReal();

            return(new CMatrix(CoordSysConverter.CartesianToSpherical(x, y, z)));
        }
Пример #2
0
        public override void Accept(TSqlFragmentVisitor visitor)
        {
            visitor.ExplicitVisit(this);

            FirstExpression?.Accept(visitor);
            SecondExpression?.Accept(visitor);
            ThirdExpression?.Accept(visitor);
        }
Пример #3
0
        public override object Evaluate()
        {
            double r     = FirstExpression.EvaluateAsReal();
            double theta = SecondExpression.EvaluateAsReal();
            double phi   = ThirdExpression.EvaluateAsReal();

            return(new CMatrix(CoordSysConverter.SphericalToCartesian(r, theta, phi)));
        }
        public override object Evaluate()
        {
            IList <double> xValues = FirstExpression.EvaluateAsRealVector();
            IList <double> yValues = SecondExpression.EvaluateAsRealVector();
            double         x       = ThirdExpression.EvaluateAsReal();

            return((Complex)(new NewtonPolynomialInterpolator(xValues, yValues).Interpolate(x)));
        }
Пример #5
0
        public override object Evaluate()
        {
            Func <Complex, Complex> targetFunc = FirstExpression.EvaluateAsFunction <Complex>(ThirdExpression);
            Complex initGuess = SecondExpression.EvaluateAsComplex();

            ComplexMullerEquationSolver solver = new ComplexMullerEquationSolver(targetFunc, initGuess);

            return(solver.Solve());
        }
Пример #6
0
 public void Demangle(DemanglingContext context)
 {
     context.Writer.Append("(");
     FirstExpression.Demangle(context);
     context.Writer.Append(")");
     OperatorName.Demangle(context);
     context.Writer.Append("(");
     SecondExpression.Demangle(context);
     context.Writer.Append(")");
 }
Пример #7
0
 public override object Evaluate()
 {
     if (ThirdExpression == Expression <Object> .Null)
     {
         return(FirstExpression.EvaluateAsCMatrix()[SecondExpression.EvaluateAsInt32()]);
     }
     else
     {
         return(FirstExpression.EvaluateAsCMatrix()[SecondExpression.EvaluateAsInt32(), ThirdExpression.EvaluateAsInt32()]);
     }
 }
        public override object Evaluate()
        {
            double a     = FirstExpression.EvaluateAsReal();
            double b     = SecondExpression.EvaluateAsReal();
            int    count = ThirdExpression.EvaluateAsInt32();

            PerformanceManager.Current.EnsureAcceptableArraySize(count);

            double[] v = new double[count];
            new UniformDistribution(a, b).GetRandomVariables(_random, v);
            return(new CMatrix(v));
        }
Пример #9
0
        public override void ToString(StringBuilder buf, int indent)
        {
            FirstExpression.ToString(buf, indent);

            if (NotDefined)
            {
                buf.Append(" NOT LIKE ");
            }
            else
            {
                buf.Append(" LIKE ");
            }

            SecondExpression.ToString(buf, indent);
        }
Пример #10
0
        public override void ToString(StringBuilder buf, int indent)
        {
            FirstExpression.ToString(buf, indent);

            switch (BinaryExpressionType)
            {
            case BinaryExpressionType.Add:
                buf.Append(" + ");
                break;

            default:
                throw new NotSupportedException();
            }

            SecondExpression.ToString(buf, indent);
        }
Пример #11
0
        public override void AddExpression(Expression activeExpression, Expression expressionToBeAdded)
        {
            int activeIndex = SecondExpression.IndexOf(activeExpression);

            if (activeIndex >= 0)
            {
                if (Caret.Instance.ExpressionSide == ExpressionSide.Right)
                {
                    activeIndex++;
                }
                SecondExpression.Insert(activeIndex, expressionToBeAdded);

                // remove auxiliary
                if (activeExpression is Auxiliary)
                {
                    SecondExpression.Remove(activeExpression);
                }

                base.UpdateChildrensBottomMargin(SecondExpression);
                return;
            }

            activeIndex = FirstExpression.IndexOf(activeExpression);
            if (activeIndex >= 0)
            {
                if (Caret.Instance.ExpressionSide == ExpressionSide.Right)
                {
                    activeIndex++;
                }
                FirstExpression.Insert(activeIndex, expressionToBeAdded);

                // remove auxiliary
                if (activeExpression is Auxiliary)
                {
                    FirstExpression.Remove(activeExpression);
                }

                base.UpdateChildrensBottomMargin(FirstExpression);
                return;
            }
            throw new KeyNotFoundException("Active expression wasn't found therefore a new expression couldn't be added.");
        }
Пример #12
0
        public override void ToString(StringBuilder buf, int indent)
        {
            FirstExpression.ToString(buf, indent);

            switch (TernaryExpressionType)
            {
            case BooleanTernaryExpressionType.Between:
                buf.Append(" BETWEEN ");
                break;

            case BooleanTernaryExpressionType.NotBetween:
                buf.Append(" NOT BETWEEN ");
                break;

            default:
                throw new NotImplementedException();
            }

            SecondExpression.ToString(buf, indent);
            buf.Append(" AND ");
            ThirdExpression.ToString(buf, indent);
        }
Пример #13
0
        public override void ToString(StringBuilder buf, int indent)
        {
            FirstExpression.ToString(buf, indent);

            buf.Append("\r\n");
            buf.Append(' ', indent);

            switch (BinaryExpressionType)
            {
            case BooleanBinaryExpressionType.And:
                buf.Append("AND ");
                break;

            case BooleanBinaryExpressionType.Or:
                buf.Append("OR ");
                break;

            default:
                throw new NotImplementedException();
            }

            SecondExpression.ToString(buf, indent);
        }
Пример #14
0
        public override void ToString(StringBuilder buf, int indent)
        {
            FirstExpression.ToString(buf, indent);

            switch (ComparisonType)
            {
            case BooleanComparisonType.Equals:
                buf.Append(" = ");
                break;

            case BooleanComparisonType.GreaterThan:
                buf.Append(" > ");
                break;

            case BooleanComparisonType.GreaterThanOrEqualTo:
                buf.Append(" >= ");
                break;

            case BooleanComparisonType.LessThan:
                buf.Append(" < ");
                break;

            case BooleanComparisonType.LessThanOrEqualTo:
                buf.Append(" <= ");
                break;

            case BooleanComparisonType.NotEqualToBrackets:
                buf.Append(" <> ");
                break;

            default:
                throw new NotImplementedException();
            }

            SecondExpression.ToString(buf, indent);
        }
Пример #15
0
 private string First(FirstExpression exp) => $"SELECT TOP(1) * FROM ({Serialize(exp.Sub)}) AS this {(exp.Predicate == null ? null : "WHERE " + Secondary.Serialize(exp.Predicate.Body))}";
Пример #16
0
 public void Interpret(Context context)
 {
     FirstExpression.Interpret(context);
     SecondExpression.Interpret(context);
 }
 public override string ToDisplayString() => $"{FirstExpression.ToDisplayString()} {Operator.ToDisplayString()} {SecondExpression.ToDisplayString()}";
 public override IEnumerable <BindingParserNode> EnumerateNodes()
 {
     return(base.EnumerateNodes().Concat(FirstExpression.EnumerateNodes()).Concat(SecondExpression.EnumerateNodes()));
 }
Пример #19
0
 public override object Evaluate()
 {
     return(CMatrix.Minor(FirstExpression.EvaluateAsCMatrix(), SecondExpression.EvaluateAsInt32(), ThirdExpression.EvaluateAsInt32()));
 }
Пример #20
0
 protected override TResult Execute(CodeActivityContext context)
 {
     return(Condition.Get <bool>(context) ?
            FirstExpression.Get <TResult>(context) :
            SecondExpression.Get <TResult>(context));
 }