public override object Evaluate(ISoqlEvaluateContext context)
        {
            object val1 = par1.Evaluate(context);
            object val2 = par2.Evaluate(context);

            return(CalcValue(op, val1, val2));
        }
        public override object Evaluate(ISoqlEvaluateContext context)
        {
            object v1 = par1.Evaluate(context);
            object v2 = par2.Evaluate(context);

            return(Compare(v1, v2, op));
        }
Beispiel #3
0
        public override object Evaluate(ISoqlEvaluateContext context)
        {
            object val = source.Evaluate(context);

            if (val == null)
            {
                return(null);
            }
            switch (type)
            {
            case "float":
                return(Convert.ToDouble(val));

            default:
                throw new NotImplementedException(type);
            }
        }
        public override object Evaluate(ISoqlEvaluateContext context)
        {
            object val = par.Evaluate(context);

            if (val == null)
            {
                return(null);
            }

            if (val is double)
            {
                return(-(double)val);
            }
            if (val is float)
            {
                return(-(float)val);
            }
            if (val is decimal)
            {
                return(-(decimal)val);
            }
            if (val is long)
            {
                return(-(long)val);
            }
            if (val is int)
            {
                return(-(int)val);
            }
            if (val is short)
            {
                return(-(short)val);
            }
            if (val is sbyte)
            {
                return(-(sbyte)val);
            }

            throw new NotSupportedException("Unary negation is not supported on " + val.GetType().Name);
        }
        public override object Evaluate(ISoqlEvaluateContext context)
        {
            object val = haystack.Evaluate(context);

            if (val == null)
            {
                return(null);
            }
            string s = (string)val;

            switch (position)
            {
            case SoqlStringContainsPosition.Start:
                return(s.StartsWith(needle));

            case SoqlStringContainsPosition.End:
                return(s.EndsWith(needle));

            case SoqlStringContainsPosition.Any:
                return(s.Contains(needle));
            }

            throw new NotImplementedException(position.ToString());
        }
Beispiel #6
0
 public object Evaluate(SoqlExpression expr, bool throwOnError)
 {
     try
     {
         EvaluateContext ec = new EvaluateContext(this);
         return expr.Evaluate(ec);
     }
     catch
     {
         if (throwOnError)
             throw;
         else
             return null;
     }
 }