Example #1
0
        // effects: Given the operation type (AND/OR/NOT) and the relevant number of
        // children, returns the corresponding bool expression
        private BoolExpression(ExprType opType, IEnumerable <BoolExpression> children)
        {
            List <BoolExpression> childList = new List <BoolExpression>(children);

            Debug.Assert(childList.Count > 0);
            // If any child is other than true or false, it will have m_memberDomainMap set
            foreach (BoolExpression child in children)
            {
                if (child.m_memberDomainMap != null)
                {
                    m_memberDomainMap = child.m_memberDomainMap;
                    break;
                }
            }

            switch (opType)
            {
            case ExprType.And:
                m_tree = new DomainAndExpr(ToBoolExprList(childList));
                break;

            case ExprType.Or:
                m_tree = new DomainOrExpr(ToBoolExprList(childList));
                break;

            case ExprType.Not:
                Debug.Assert(childList.Count == 1);
                m_tree = new DomainNotExpr(childList[0].m_tree);
                break;

            default:
                Debug.Fail("Unknown expression type");
                break;
            }
        }
Example #2
0
            internal override DbExpression VisitAnd(DomainAndExpr expression)
            {
                DbExpression cqt = VisitAndOr(expression, DbExpressionBuilder.And);

                Debug.Assert(cqt != null, "AND must have at least one child");
                return(cqt);
            }
Example #3
0
 internal override StringBuilder VisitAnd(DomainAndExpr expression)
 {
     return(VisitAndOr(expression, "AND"));
 }
Example #4
0
 internal override IEnumerable <DomainTermExpr> VisitAnd(DomainAndExpr expression)
 {
     return(VisitTreeNode(expression));
 }
Example #5
0
 internal override bool VisitAnd(DomainAndExpr expression)
 {
     return(VisitAndOr(expression));
 }