예제 #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;
            }
        }
예제 #2
0
 protected override StringBuilder NotExprAsCql(DomainNotExpr expression)
 {
     m_builder.Append("NOT(");
     expression.Child.Accept(this); // we do not need the returned StringBuilder -- it is the same as m_builder
     m_builder.Append(")");
     return(m_builder);
 }
예제 #3
0
 internal override StringBuilder VisitNot(DomainNotExpr expression)
 {
     m_builder.Append("NOT(");
     expression.Child.Accept(this);
     m_builder.Append(")");
     return(m_builder);
 }
예제 #4
0
        internal override DomainBoolExpr FixRange(Set <Constant> range, MemberDomainMap memberDomainMap)
        {
            Debug.Assert(range.Count == 1, "For BoolLiterals, there should be precisely one value - true or false");
            ScalarConstant scalar = (ScalarConstant)range.First();
            DomainBoolExpr expr   = GetDomainBoolExpression(memberDomainMap);

            if ((bool)scalar.Value == false)
            {
                // The range of the variable was "inverted". Return a NOT of
                // the expression
                expr = new DomainNotExpr(expr);
            }
            return(expr);
        }
예제 #5
0
            internal override StringBuilder VisitNot(DomainNotExpr expression)
            {
                m_skipIsNotNull = false; // Cannot skip in NOTs

                DomainTermExpr termExpr = expression.Child as DomainTermExpr;

                if (termExpr != null)
                {
                    BoolLiteral literal = BoolExpression.GetBoolLiteral(termExpr);
                    return(literal.AsNegatedUserString(m_builder, m_blockAlias, m_skipIsNotNull));
                }
                else
                {
                    m_builder.Append("NOT(");
                    // We do not need the returned StringBuilder -- it is the same as m_builder
                    expression.Child.Accept(this);
                    m_builder.Append(")");
                }
                return(m_builder);
            }
예제 #6
0
 internal override IEnumerable <DomainTermExpr> VisitNot(DomainNotExpr expression)
 {
     Debug.Assert(m_allowAllOperators, "Term should not be called when Nots are present in the expression");
     return(VisitTreeNode(expression));
 }
예제 #7
0
 protected abstract T_Return NotExprAsCql(DomainNotExpr expression);
예제 #8
0
 internal override T_Return VisitNot(DomainNotExpr expression)
 {
     m_skipIsNotNull = false; // Cannot skip in NOTs
     return(NotExprAsCql(expression));
 }
예제 #9
0
            protected override DbExpression NotExprAsCql(DomainNotExpr expression)
            {
                DbExpression cqt = expression.Child.Accept(this);

                return(cqt.Not());
            }
예제 #10
0
 internal override bool VisitNot(DomainNotExpr expression)
 {
     return(expression.Child.Accept(this));
 }