Beispiel #1
0
        /// <summary>
        /// create a bool expr as the root expr of the search unit.
        /// </summary>
        /// <param name="searchEntityUnit"></param>
        /// <param name="searchPropParent"></param>
        /// <returns></returns>
        public SearchPropBoolExpr AddSearchPropBoolExpr(SearchEntity searchEntity, SearchBoolOperator oper)
        {
            if (searchEntity == null)
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (searchEntity.SearchPropRoot != null)
            {
                // a criterion already exists!
                return(null);
            }

            SearchPropBoolExpr expr = new SearchPropBoolExpr();

            expr.Operator = oper;

            searchEntity.SearchPropRoot = expr;
            return(expr);
        }
Beispiel #2
0
        /// <summary>
        /// create a boolean expression.
        /// </summary>
        /// <param name="searchEntityUnit"></param>
        /// <param name="searchPropParent"></param>
        /// <returns></returns>
        public SearchPropBoolExpr AddSearchPropBoolExpr(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, SearchBoolOperator oper)
        {
            if (searchEntity == null)
            {
                return(null);
            }
            if (boolExprParent == null)
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (searchEntity.SearchPropRoot != null)
            {
                // a criterion already exists!
                return(null);
            }

            // check that the criterion does not already exists
            if (boolExprParent.GetLeftOrRight(leftOrRight) != null)
            {
                return(null);
            }

            SearchPropBoolExpr expr = new SearchPropBoolExpr();

            expr.Operator = oper;

            // set the prop operand to the left or to the right
            boolExprParent.SetLeftOrRight(leftOrRight, expr);
            return(expr);
        }