Exemplo n.º 1
0
        /// <summary>
        /// Returns the string representation of the expression.
        /// </summary>
        /// <returns>Returns the string representation of the expression.</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (Operand1.IsAtomOrPrimitive())
            {
                sb.Append(Operand1);
            }
            else
            {
                sb.Append("(").Append(Operand1.ToString()).Append(")");
            }
            sb.Append(" ").Append(Operator1).Append(" ");
            if (Operand2.IsAtomOrPrimitive())
            {
                sb.Append(Operand2);
            }
            else
            {
                sb.Append("(").Append(Operand2.ToString()).Append(")");
            }
            sb.Append(" ").Append(Operator2).Append(" ");
            if (Operand3.IsAtomOrPrimitive())
            {
                sb.Append(Operand3);
            }
            else
            {
                sb.Append("(").Append(Operand3.ToString()).Append(")");
            }
            return(sb.ToString());
        }