public override SoqlExpression Simplify()
        {
            par1 = (SoqlBooleanExpression)par1.Simplify();
            par2 = (SoqlBooleanExpression)par2.Simplify();

            ISoqlConstantExpression cp1 = par1 as ISoqlConstantExpression;
            ISoqlConstantExpression cp2 = par2 as ISoqlConstantExpression;

            // left subexpression is true - our node is true

            if (cp1 != null && (bool)cp1.GetConstantValue() == true)
                return new SoqlBooleanLiteralExpression(true);

            // right subexpression is true - our node is true

            if (cp2 != null && (bool)cp2.GetConstantValue() == true)
                return new SoqlBooleanLiteralExpression(true);

            // both are constant and false - our node is false

            if (cp1 != null && cp2 != null)
                return new SoqlBooleanLiteralExpression(false);

            if (cp1 != null && (bool)cp1.GetConstantValue() == false)
                return par2;

            if (cp2 != null && (bool)cp2.GetConstantValue() == false)
                return par1;

            return this;
        }
 public SoodaQuerySource(SoodaTransaction transaction, Sooda.Schema.ClassInfo classInfo, SoodaSnapshotOptions options)
 {
     _transaction = transaction;
     _classInfo   = classInfo;
     _options     = options;
     _where       = null;
 }
 public SoodaQuerySource(SoodaTransaction transaction, Sooda.Schema.ClassInfo classInfo, SoqlBooleanExpression where)
 {
     _transaction = transaction;
     _classInfo   = classInfo;
     _options     = SoodaSnapshotOptions.Default;
     _where       = where;
 }
        protected Sooda.QL.TypedWrappers.SoqlBooleanWrapperExpression ContainsExprImpl(string fromClass, SoqlBooleanExpression expr)
        {
            SoqlQueryExpression query = new SoqlQueryExpression();
            query.From.Add(fromClass);
            query.FromAliases.Add("");
            query.WhereClause = expr;

            return new SoqlBooleanWrapperExpression(new SoqlContainsExpression(_left, _collectionName, query));
        }
Beispiel #5
0
        public override SoqlExpression Simplify()
        {
            Left  = (SoqlBooleanExpression)Left.Simplify();
            Right = (SoqlBooleanExpression)Right.Simplify();

            ISoqlConstantExpression cp1 = Left as ISoqlConstantExpression;
            ISoqlConstantExpression cp2 = Right as ISoqlConstantExpression;

            // left subexpression is false - our node is false

            if (cp1 != null && (bool)cp1.GetConstantValue() == false)
            {
                return(new SoqlBooleanLiteralExpression(false));
            }

            // right subexpression is false - our node is false

            if (cp2 != null && (bool)cp2.GetConstantValue() == false)
            {
                return(new SoqlBooleanLiteralExpression(false));
            }

            // both are constant and not false - our node is true

            if (cp1 != null && cp2 != null)
            {
                return(new SoqlBooleanLiteralExpression(true));
            }

            // left subexpression is true - we return the right node

            if (cp1 != null && (bool)cp1.GetConstantValue() == true)
            {
                return(Right);
            }

            // right subexpression is true - we return the left node

            if (cp2 != null && (bool)cp2.GetConstantValue() == true)
            {
                return(Left);
            }

            // cannot simplify anymore
            return(this);
        }
        public override SoqlExpression Simplify()
        {
            par1 = (SoqlBooleanExpression)par1.Simplify();
            par2 = (SoqlBooleanExpression)par2.Simplify();

            ISoqlConstantExpression cp1 = par1 as ISoqlConstantExpression;
            ISoqlConstantExpression cp2 = par2 as ISoqlConstantExpression;

            // left subexpression is true - our node is true

            if (cp1 != null && (bool)cp1.GetConstantValue() == true)
            {
                return(new SoqlBooleanLiteralExpression(true));
            }

            // right subexpression is true - our node is true

            if (cp2 != null && (bool)cp2.GetConstantValue() == true)
            {
                return(new SoqlBooleanLiteralExpression(true));
            }

            // both are constant and false - our node is false

            if (cp1 != null && cp2 != null)
            {
                return(new SoqlBooleanLiteralExpression(false));
            }

            if (cp1 != null && (bool)cp1.GetConstantValue() == false)
            {
                return(par2);
            }

            if (cp2 != null && (bool)cp2.GetConstantValue() == false)
            {
                return(par1);
            }

            return(this);
        }
        public override SoqlExpression Simplify()
        {
            Left = (SoqlBooleanExpression)Left.Simplify();
            Right = (SoqlBooleanExpression)Right.Simplify();

            ISoqlConstantExpression cp1 = Left as ISoqlConstantExpression;
            ISoqlConstantExpression cp2 = Right as ISoqlConstantExpression;

            // left subexpression is false - our node is false

            if (cp1 != null && (bool)cp1.GetConstantValue() == false)
                return new SoqlBooleanLiteralExpression(false);

            // right subexpression is false - our node is false

            if (cp2 != null && (bool)cp2.GetConstantValue() == false)
                return new SoqlBooleanLiteralExpression(false);

            // both are constant and not false - our node is true

            if (cp1 != null && cp2 != null)
                return new SoqlBooleanLiteralExpression(true);

            // left subexpression is true - we return the right node

            if (cp1 != null && (bool)cp1.GetConstantValue() == true)
                return Right;

            // right subexpression is true - we return the left node

            if (cp2 != null && (bool)cp2.GetConstantValue() == true)
                return Left;

            // cannot simplify anymore
            return this;
        }
Beispiel #8
0
 public SoodaWhereClause(SoqlBooleanExpression whereExpression)
 {
     this.WhereExpression = whereExpression;
 }
Beispiel #9
0
 public SoodaWhereClause(SoqlBooleanExpression whereExpression, params object[] par)
 {
     this.Parameters      = par;
     this.WhereExpression = whereExpression;
 }
Beispiel #10
0
 public SoqlConditionalExpression(SoqlBooleanExpression condition, SoqlExpression ifTrue, SoqlExpression ifFalse)
 {
     this.condition = condition;
     this.ifTrue    = ifTrue;
     this.ifFalse   = ifFalse;
 }
 public SoqlBooleanOrExpression(SoqlBooleanExpression par1, SoqlBooleanExpression par2)
 {
     this.par1 = par1;
     this.par2 = par2;
 }
 public SoodaObjectListSnapshot(IList list, SoqlBooleanExpression filterExpression) : this(list, new SoodaWhereClause(filterExpression))
 {
 }
Beispiel #13
0
 public ISoodaObjectList Filter(SoqlBooleanExpression filterExpression)
 {
     return(new SoodaObjectListSnapshot(this, filterExpression));
 }
 public SoqlBooleanExpression And(SoqlBooleanExpression expr)
 {
     return new SoqlBooleanAndExpression(this, expr);
 }
 public SoqlBooleanExpression Or(SoqlBooleanExpression expr)
 {
     return new SoqlBooleanOrExpression(this, expr);
 }
        protected Sooda.QL.TypedWrappers.SoqlBooleanWrapperExpression ContainsExprImpl(string fromClass, SoqlBooleanExpression expr)
        {
            SoqlQueryExpression query = new SoqlQueryExpression();

            query.From.Add(fromClass);
            query.FromAliases.Add("");
            query.WhereClause = expr;

            return(new SoqlBooleanWrapperExpression(new SoqlContainsExpression(_left, _collectionName, query)));
        }
 public override SoqlExpression Simplify()
 {
     par = (SoqlBooleanExpression)par.Simplify();
     return(this);
 }
 public SoqlConditionalExpression(SoqlBooleanExpression condition, SoqlExpression ifTrue, SoqlExpression ifFalse)
 {
     this.condition = condition;
     this.ifTrue = ifTrue;
     this.ifFalse = ifFalse;
 }
 public SoqlBooleanAndExpression(SoqlBooleanExpression Left, SoqlBooleanExpression Right)
 {
     this.Left = Left;
     this.Right = Right;
 }
 public override SoqlExpression Simplify()
 {
     par = (SoqlBooleanExpression)par.Simplify();
     return this;
 }
 public SoqlBooleanNegationExpression(SoqlBooleanExpression par)
 {
     this.par = par;
 }
Beispiel #22
0
 public SoqlBooleanAndExpression(SoqlBooleanExpression Left, SoqlBooleanExpression Right)
 {
     this.Left  = Left;
     this.Right = Right;
 }
 public SoqlBooleanNegationExpression(SoqlBooleanExpression par)
 {
     this.par = par;
 }
 public SoqlBooleanOrExpression(SoqlBooleanExpression par1, SoqlBooleanExpression par2)
 {
     this.par1 = par1;
     this.par2 = par2;
 }