public SearchPropBase GetLeftOrRight(BoolExprOperand operand) { if (operand == BoolExprOperand.Left) { return(LeftOperand); } return(RightOperand); }
public void SetLeftOrRight(BoolExprOperand operand, SearchPropBase prop) { if (operand == BoolExprOperand.Left) { LeftOperand = prop; return; } RightOperand = prop; }
/// <summary> /// Add a property criterion to a search unit. /// set to the left or to the right operand of the expression. /// </summary> /// <param name="criteria"></param> /// <param name="keyText"></param> /// <returns></returns> public SearchPropCriterionKeyText AddCritPropKeyText(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, string keyText) { if (searchEntity == null) { return(null); } if (boolExprParent == null) { return(null); } // check the text if (string.IsNullOrWhiteSpace(keyText)) { return(null); } // check that the criterion does not already exists if (boolExprParent.GetLeftOrRight(leftOrRight) != null) { return(null); } SearchPropCriterionKeyText criterionPropKeyText = CreateSearchPropCriterionPropKeyText(keyText); // set the prop operand to the left or to the right boolExprParent.SetLeftOrRight(leftOrRight, criterionPropKeyText); return(criterionPropKeyText); }
/// <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); }