Perform() public abstract method

Performs the operation with the 2 evaluated values.
public abstract Perform ( Value left, Value right ) : Value
left Value The left value.
right Value The right value.
return Value
Exemplo n.º 1
0
        /// <summary>
        /// Performs the evaluation of the dot operator.
        /// </summary>
        /// <param name="left">The left value.</param>
        /// <param name="right">The right value.</param>
        /// <returns>The result of the operation.</returns>
        public override Value Perform(Value left, Value right)
        {
            if (left is NumericValue == false)
            {
                throw new YAMPOperationInvalidException(Op, left);
            }

            if (right is NumericValue == false)
            {
                throw new YAMPOperationInvalidException(Op, right);
            }

            if (left is MatrixValue && right is MatrixValue)
            {
                var l = (MatrixValue)left;
                var r = (MatrixValue)right;
                return(Dot(l, r));
            }
            else if (left is MatrixValue && right is ScalarValue)
            {
                var l = (MatrixValue)left;
                var r = (ScalarValue)right;
                return(Dot(l, r));
            }
            else if (left is ScalarValue && right is MatrixValue)
            {
                var l = (ScalarValue)left;
                var r = (MatrixValue)right;
                return(Dot(l, r));
            }

            return(_top.Perform(left, right));
        }