IsLeaf() public method

Indicates whether this object contains the full expression
public IsLeaf ( ) : bool
return bool
Ejemplo n.º 1
0
        /// <summary>
        /// Private constructor to create a new expression using the
        /// expression string provided
        /// </summary>
        /// <param name="expressionString">The expression string</param>
        private Expression(string expressionString)
        {
            //TODO: Error check valid inputs
            CriteriaExpression c = new CriteriaExpression(expressionString, _operators);

            //Create left expression
            if (c.IsLeaf())
            {
            }
            if (c.Left.IsLeaf())
            {
                _leftExpression = new Parameter(c.Left.CompleteExpression);
            }
            else
            {
                _leftExpression = new Expression(c.Left.CompleteExpression);
            }

            //Create operator
            _sqlOperator = new SqlOperator(c.Expression);

            //Create right expression
            if (c.Right.IsLeaf())
            {
                _rightExpression = new Parameter(c.Right.CompleteExpression);
            }
            else
            {
                _rightExpression = new Expression(c.Right.CompleteExpression);
            }
        }
Ejemplo n.º 2
0
//		public string SqlExpressionString(string tableNameFieldNameLeftSeperator,
//		                                  string tableNameFieldNameRightSeperator,
//		                                  string dateTimeLeftSeperator,
//		                                  string dateTimeRightSeperator) 
//      {
//			return "(" + _leftExpression.SqlExpressionString(tableNameFieldNameLeftSeperator,
//			                                                 tableNameFieldNameRightSeperator, dateTimeLeftSeperator, dateTimeRightSeperator) +
//				" " + _sqlOperator.ExpressionString() +
//				" " + _rightExpression.SqlExpressionString(tableNameFieldNameLeftSeperator,
//				                                           tableNameFieldNameRightSeperator, dateTimeLeftSeperator, dateTimeRightSeperator) + ")";
        //		}

        #endregion //IExpression Interface Implementation

        #region Static Members

        /// <summary>
        /// Creates a new IExpression object using the expression string provided.
        /// </summary>
        /// <param name="expressionClause">The expression string</param>
        /// <returns>If the expression is a leaf object (it has no left and right
        /// expressions), then a Parameter object is returned, otherwise an
        /// Expression object is returned.</returns>
        public static IExpression CreateExpression(string expressionClause)
        {
            CriteriaExpression c = new CriteriaExpression(expressionClause, _operators);
            if (c.IsLeaf())
            {
                return new Parameter(expressionClause);
            }
            return new Expression(expressionClause);
        }