Exemplo n.º 1
0
            private StringBuilder VisitAndOr(DomainTreeExpr expression, ExprType kind)
            {
                Debug.Assert(kind == ExprType.Or || kind == ExprType.And);

                m_builder.Append('(');
                bool isFirstChild = true;

                foreach (DomainBoolExpr child in expression.Children)
                {
                    if (false == isFirstChild)
                    {
                        // Add the operator
                        if (kind == ExprType.And)
                        {
                            m_builder.Append(" AND ");
                        }
                        else
                        {
                            m_builder.Append(" OR ");
                        }
                    }
                    isFirstChild = false;
                    // Recursively get the CQL for the child
                    child.Accept(this);
                }
                m_builder.Append(')');
                return(m_builder);
            }
Exemplo n.º 2
0
 private IEnumerable <DomainTermExpr> VisitTreeNode(DomainTreeExpr expression)
 {
     foreach (DomainBoolExpr child in expression.Children)
     {
         foreach (DomainTermExpr result in child.Accept(this))
         {
             yield return(result);
         }
     }
 }
Exemplo n.º 3
0
            private DbExpression VisitAndOr(DomainTreeExpr expression, Func <DbExpression, DbExpression, DbExpression> op)
            {
                DbExpression cqt = null;

                foreach (var child in expression.Children)
                {
                    if (cqt == null)
                    {
                        cqt = child.Accept(this);
                    }
                    else
                    {
                        cqt = op(cqt, child.Accept(this));
                    }
                }
                return(cqt);
            }
Exemplo n.º 4
0
            private StringBuilder VisitAndOr(DomainTreeExpr expression, string opAsString)
            {
                List <string> childrenStrings = new List <string>();
                StringBuilder builder         = m_builder;

                // Save the old string builder and pass a new one to each child
                foreach (DomainBoolExpr child in expression.Children)
                {
                    m_builder = new StringBuilder();
                    child.Accept(this);
                    childrenStrings.Add(m_builder.ToString());
                }
                // Now store the children in a sorted manner
                m_builder = builder;
                m_builder.Append('(');
                StringUtil.ToSeparatedStringSorted(m_builder, childrenStrings, " " + opAsString + " ");
                m_builder.Append(')');
                return(m_builder);
            }
Exemplo n.º 5
0
            private bool VisitAndOr(DomainTreeExpr expression)
            {
                // If any child is not final, tree is not final -- we cannot
                // have a mix of final and non-final trees!
                bool isFirst = true;
                bool result  = true;

                foreach (DomainBoolExpr child in expression.Children)
                {
                    if (child as DomainFalseExpr != null || child as DomainTrueExpr != null)
                    {
                        // Ignore true or false since they carry no information
                        continue;
                    }
                    bool isChildFinal = child.Accept(this);
                    if (isFirst)
                    {
                        result = isChildFinal;
                    }
                    Debug.Assert(result == isChildFinal, "All children must be final or non-final");
                    isFirst = false;
                }
                return(result);
            }