예제 #1
0
        //TODO: Review the types in this function
        public void VerifyOperation_Diff()
        {
            if (Operand1Type.IsScalar() && Operand2Type.IsScalar())
            {
                ForceAtomicOperands(ScalarType);
            }

            else if (Operand1Type.IsFrameMultivector() && Operand2Type.IsScalar())
            {
                ForceAtomicOperands(Operand1Type);
            }

            else if (Operand2Type.IsFrameMultivector() && Operand1Type.IsScalar())
            {
                ForceAtomicOperands(Operand2Type);
            }

            else if (Operand1Type.HasSameFrame(Operand2Type))
            {
                ForceAtomicOperands(Operand1Type);
            }

            else
            {
                Context.CreateTypeMismatch("Cannot apply Diff to expressions of type " + Operand1TypeSignature + " and " + Operand2TypeSignature);
            }
        }
예제 #2
0
        private void VerifyOperation_Times()
        {
            if (Operand1Type.IsNumber() && Operand2Type.IsNumber())
            {
                ForceAtomicScalarOperands(ScalarType);
            }

            else if (Operand1Type.IsFrameMultivector() && Operand2Type.IsNumber())
            {
                _resultType = Operand1Type;

                _atomicOperand1 = Context.ActiveParentCommandBlock.ExpressionToMultivectorAtomicExpression(OperandsMultivectorType, _operand1);

                _atomicOperand2 = Context.ActiveParentCommandBlock.ExpressionToScalarAtomicExpression(_operand2);
            }

            else if (Operand1Type.IsNumber() && Operand2Type.IsFrameMultivector())
            {
                _resultType = Operand2Type;

                _atomicOperand1 = Context.ActiveParentCommandBlock.ExpressionToScalarAtomicExpression(_operand1);

                _atomicOperand2 = Context.ActiveParentCommandBlock.ExpressionToMultivectorAtomicExpression(OperandsMultivectorType, _operand2);
            }

            else
            {
                Context.CreateTypeMismatch("cannot apply Times to expressions of type " + Operand1TypeSignature + " and " + Operand2TypeSignature);
            }
        }
예제 #3
0
        private void VerifyOperation_MultivectorProduct()
        {
            if (Operand1Type.IsNumber() && Operand2Type.IsNumber())
            {
                ForceAtomicScalarOperands(ScalarType);
            }

            else if (Operand1Type.IsFrameMultivector() && Operand2Type.IsNumber())
            {
                ForceAtomicMultivectorOperands(Operand1Type);
            }

            else if (Operand2Type.IsFrameMultivector() && Operand1Type.IsNumber())
            {
                ForceAtomicMultivectorOperands(Operand2Type);
            }

            else if (Operand1Type.HasSameFrame(Operand2Type))
            {
                ForceAtomicMultivectorOperands(Operand1Type);
            }

            else
            {
                Context.CreateTypeMismatch("cannot apply a multivector product to expressions of type " + Operand1TypeSignature + " and " + Operand2TypeSignature);
            }
        }
예제 #4
0
        private void VerifyOperation_BinaryPlusMinus()
        {
            if (Operand1Type.IsInteger() && Operand2Type.IsInteger())
            {
                ForceAtomicOperands(IntegerType);
            }

            else if (Operand1Type.IsNumber() && Operand2Type.IsNumber())
            {
                ForceAtomicScalarOperands(ScalarType);
            }

            else if (Operand1Type.IsFrameMultivector() && Operand2Type.IsNumber())
            {
                ForceAtomicMultivectorOperands(Operand1Type);
            }

            else if (Operand2Type.IsFrameMultivector() && Operand1Type.IsNumber())
            {
                ForceAtomicMultivectorOperands(Operand2Type);
            }

            else if (Operand1Type.HasSameFrame(Operand2Type))
            {
                ForceAtomicMultivectorOperands(Operand1Type);
            }

            else
            {
                Context.CreateTypeMismatch(@"Cannot apply +\- to expressions of type " + Operand1TypeSignature + " and " + Operand2TypeSignature);
            }
        }