Beispiel #1
0
        /// <summary>
        /// IComparable.CompareTo implementation.
        /// </summary>
        public int CompareTo(object obj)
        {
            if (obj is BinaryScalarOp)
            {
                BinaryScalarOp I          = (BinaryScalarOp)obj;
                int            opNameComp = m_opName.CompareTo(I.m_opName);
                if (opNameComp != 0)
                {
                    return(opNameComp);
                }

                int value1Comp = Util.CompareScalarMultivector(this.value1, I.value1);
                if (value1Comp != 0)
                {
                    return(value1Comp);
                }

                else
                {
                    return(Util.CompareScalarMultivector(this.value2, I.value2));
                }
            }

            throw new ArgumentException("BinaryScalarOp.CompareTo(): object is not an BinaryScalarOp");
        }
Beispiel #2
0
        } // end of function ScalarOpToLangString()

        /// <summary>
        /// Converts a <c>RefGA.Symbolic.BinaryScalarOpToLangString</c> to code.
        ///
        /// Handles special cases (such as inversion) and understands floating point
        /// types (e.g., <c>fabsf()</c> is used for floats and <c>fabs()</c> is used for doubles in C.
        /// </summary>
        /// <param name="S">Used for output language.</param>
        /// <param name="FT">Floating point type used.</param>
        /// <param name="Op">The operation to convert to code.</param>
        /// <returns>Code for implementing <c>Op</c>c>.</returns>
        public static string BinaryScalarOpToLangString(G25.Specification S, G25.FloatType FT, RefGA.Symbolic.BinaryScalarOp Op)
        {
            string value1Str = ScalarOpValueToLangString(S, FT, Op.value1);
            string value2Str = ScalarOpValueToLangString(S, FT, Op.value2);

            return(OpNameToLangString(S, FT, Op.opName) + "(" + value1Str + ", " + value2Str + ")");
        } // end of function BinaryScalarOpToLangString()