internal Expression Create(string @operator, Expression operand) { switch (@operator) { case Symbol.Arccos: return new InverseCosineUnaryExpression(operand); case Symbol.Arcsin: return new InverseSineUnaryExpression(operand); case Symbol.Arctan: return new InverseTangentUnaryExpression(operand); case Symbol.Cos: return new CosineUnaryExpression(operand); case Symbol.Cosh: return new HyperbolicCosineUnaryExpression(operand); case Symbol.Factorial: return new FactorialUnaryExpression(operand); case Symbol.Lg: return new Log2UnaryExpression(operand); case Symbol.Ln: return new LnUnaryExpression(operand); case Symbol.Log: return new Log10UnaryExpression(operand); case Symbol.Sin: return new SineUnaryExpression(operand); case Symbol.Sinh: return new HyperbolicSineUnaryExpression(operand); case Symbol.SquareRoot: return new SquareRootUnaryExpression(operand); case Symbol.Subtraction: return new NotUnaryExpression(operand); case Symbol.Tan: return new TangentUnaryExpression(operand); case Symbol.Tanh: return new HyperbolicTangentUnaryExpression(operand); default: throw new NotSupportedException(@operator); } }
internal Expression Create(string @operator, Expression operand2, Expression operand1) { switch (@operator) { case Symbol.Addition: return new AdditionBinaryExpression(operand1, operand2); case Symbol.Division: return new DivisionBinaryExpression(operand1, operand2); case Symbol.Modulo: return new ModuloBinaryExpression(operand1, operand2); case Symbol.Multiplication: return new MultiplicationBinaryExpression(operand1, operand2); case Symbol.Power: return new PowerBinaryExpression(operand1, operand2); case Symbol.Subtraction: return new SubtractionBinaryExpression(operand1, operand2); default: throw new NotSupportedException(@operator); } }