Exemple #1
0
        public DataTypeValue Evaluate(EvaluationContext ctx, string SchemeID)
        {
            IList <DataTypeValue> rets = new List <DataTypeValue>();

            foreach (IEvaluatable e in this._evaluatable)
            {
                rets.Add(e.Evaluate(ctx, SchemeID));
            }
            return(FunctionFactory.Evaluate(this._functionId, rets.ToArray(), ctx));
        }
Exemple #2
0
 private void ExcuteOne(string functionid, DataTypeValue input, BagDataType output, EvaluationContext ctx)
 {
     DataTypeValue[] newparams = { input };
     try
     {
         output.AddDataType(FunctionFactory.Evaluate(functionid, newparams, ctx));
     }
     catch (Indeterminate ex)
     {
         throw new IllegalExpressionEvaluationException(ex.Message);
     }
 }
Exemple #3
0
        public DataTypeValue Evaluate(EvaluationContext ctx, string SchemeID)
        {
            var           args     = (BagDataType)this._evaluatable.Evaluate(ctx, SchemeID);
            IList         children = args.Children;
            DataTypeValue ret      = null;

            foreach (object o in children)
            {
                var arg     = (DataTypeValue)o;
                var @params = new[] { this._attributeValue.DataTypeValue, arg };
                ret = FunctionFactory.Evaluate(this._matchId.Value, @params, ctx);
                if (BooleanDataType.True.Equals(ret))
                {
                    return(ret);
                }
            }
            return(BooleanDataType.False);
        }
Exemple #4
0
        public override DataTypeValue Evaluate(DataTypeValue[] @params, EvaluationContext ctx)
        {
            int size = @params.Length;

            if (size == paramsnum)
            {
                if (BooleanDataType.True.Equals(@params[1]))
                {
                    return(BooleanDataType.True);
                }
                else
                {
                    return(BooleanDataType.False);
                }
            }
            else if (size > paramsnum && (@params[size - 1] is BagDataType))
            {
                string functionid = @params[0].Value;
                var    bag        = (BagDataType)@params[size - 1];
                IList  children   = bag.Children;
                for (int i = 1; i < size - 1; i++)
                {
                    for (int j = 0; j < children.Count; j++)
                    {
                        DataTypeValue[] newparams = { @params[i], (DataTypeValue)children[j] };
                        try
                        {
                            if (BooleanDataType.True.Equals(FunctionFactory.Evaluate(functionid, newparams, ctx)))
                            {
                                return(BooleanDataType.True);
                            }
                        }
                        catch (Indeterminate ex)
                        {
                            throw new IllegalExpressionEvaluationException(ex.Message);
                        }
                    }
                }
                return(BooleanDataType.False);
            }
            throw new IllegalExpressionEvaluationException(stringIdentifer);
        }
Exemple #5
0
        private bool IsOneOfBag(string functionid, DataTypeValue one, BagDataType bag, EvaluationContext ctx)
        {
            IList children = bag.Children;

            for (int j = 0; j < children.Count; j++)
            {
                DataTypeValue[] newparams = { one, (DataTypeValue)children[j] };
                try
                {
                    if (BooleanDataType.False.Equals(FunctionFactory.Evaluate(functionid, newparams, ctx)))
                    {
                        return(false);
                    }
                }
                catch (Indeterminate ex)
                {
                    throw new IllegalExpressionEvaluationException(ex.Message);
                }
            }
            return(true);
        }