Beispiel #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;
            }
        }
Beispiel #2
0
            internal override DbExpression VisitOr(DomainOrExpr expression)
            {
                DbExpression cqt = VisitAndOr(expression, DbExpressionBuilder.Or);

                Debug.Assert(cqt != null, "OR must have at least one child");
                return(cqt);
            }
Beispiel #3
0
 internal override StringBuilder VisitOr(DomainOrExpr expression)
 {
     return(VisitAndOr(expression, "OR"));
 }
Beispiel #4
0
 internal override IEnumerable <DomainTermExpr> VisitOr(DomainOrExpr expression)
 {
     Debug.Assert(m_allowAllOperators, "TermVisitor should not be called when Ors are present in the expression");
     return(VisitTreeNode(expression));
 }
Beispiel #5
0
 internal override bool VisitOr(DomainOrExpr expression)
 {
     return(VisitAndOr(expression));
 }