Exemple #1
0
        public override void WriteCql(StringBuilder queryBuilder)
        {
            if (FirstTerm == null)
            {
                return;
            }

            if (OperationType == ArithmeticOperationTypes.Negative)
            {
                queryBuilder.Append("-");

                FirstTerm.WriteCql(queryBuilder);
            }
            else
            {
                if (SecondTerm == null)
                {
                    return;
                }

                queryBuilder.Append("(");

                FirstTerm.WriteCql(queryBuilder);

                switch (OperationType)
                {
                case ArithmeticOperationTypes.Addition:
                    queryBuilder.Append(" + ");
                    break;

                case ArithmeticOperationTypes.Subtraction:
                    queryBuilder.Append(" - ");
                    break;

                case ArithmeticOperationTypes.Division:
                    queryBuilder.Append(" / ");
                    break;

                case ArithmeticOperationTypes.Multiplication:
                    queryBuilder.Append(" * ");
                    break;

                case ArithmeticOperationTypes.Modulus:
                    queryBuilder.Append(" % ");
                    break;
                }

                SecondTerm.WriteCql(queryBuilder);

                queryBuilder.Append(")");
            }
        }
Exemple #2
0
 public override string ToString(int indentLevel)
 {
     return(base.ToString(indentLevel) + "\r\n" + FirstTerm.ToString(indentLevel + 1) + "\r\n" + SecondTerm.ToString(indentLevel + 1));
 }