/// <summary> /// Evaluates the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The function arguments.</param> /// <returns>The result value of the function evaluation.</returns> public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } var retBag = new BagValue(DataType); IFunction functionDup = DataType.IsInFunction; foreach (object par1 in args[0].Elements) { EvaluationValue retVal = functionDup.Evaluate(context, new EvaluationValue(par1, args[0].GetType(context)), retBag); if (!retVal.BoolValue) { retBag.Add(new EvaluationValue(par1, args[0].GetType(context))); } } foreach (object par2 in args[1].Elements) { EvaluationValue retVal = functionDup.Evaluate(context, new EvaluationValue(par2, args[1].GetType(context)), retBag); if (!retVal.BoolValue) { retBag.Add(new EvaluationValue(par2, args[1].GetType(context))); } } return(new EvaluationValue(retBag, DataType)); }
/// <summary> /// Evaluates the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The function arguments.</param> /// <returns>The result value of the function evaluation.</returns> public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args) { if (context == null) throw new ArgumentNullException("context"); if (args == null) throw new ArgumentNullException("args"); var retBag = new BagValue(DataType); IFunction functionDup = DataType.IsInFunction; foreach (object par1 in args[0].Elements) { EvaluationValue retVal = functionDup.Evaluate(context, new EvaluationValue(par1, args[0].GetType(context)), retBag); if (!retVal.BoolValue) { retBag.Add(new EvaluationValue(par1, args[0].GetType(context))); } } foreach (object par2 in args[1].Elements) { EvaluationValue retVal = functionDup.Evaluate(context, new EvaluationValue(par2, args[1].GetType(context)), retBag); if (!retVal.BoolValue) { retBag.Add(new EvaluationValue(par2, args[1].GetType(context))); } } return new EvaluationValue(retBag, DataType); }
/// <summary> /// Method called by the EvaluationEngine to evaluate the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The IFuctionParameters that will be used as arguments to the function.</param> /// <returns></returns> public override EvaluationValue Evaluate(EvaluationContext context, params inf.IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } inf.IFunction function = args[0].GetFunction(0); if (!args[1].IsBag) { return(EvaluationValue.False); } BagValue retVal = new BagValue(args[1].GetType(context)); foreach (object par in args[1].Elements) { retVal.Add( function.Evaluate( context, new EvaluationValue(par, args[1].GetType(context)))); } return(new EvaluationValue(retVal, args[1].GetType(context))); }
/// <summary> /// Evaluates the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The function arguments.</param> /// <returns>The result value of the function evaluation.</returns> public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args) { if (context == null) throw new ArgumentNullException("context"); if (args == null) throw new ArgumentNullException("args"); IDataType type = DataType; var bag = new BagValue(type); for (int i = 0; i < args.Length; i++) { bag.Add(args[i].GetTypedValue(type, i)); } return new EvaluationValue(bag, type); }
/// <summary> /// Method called by the EvaluationEngine to evaluate the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The IFuctionParameters that will be used as arguments to the function.</param> /// <returns></returns> public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args) { if (context == null) throw new ArgumentNullException("context"); if (args == null) throw new ArgumentNullException("args"); IFunction function = args[0].GetFunction(0); if (!args[1].IsBag) { return EvaluationValue.False; } var retVal = new BagValue(args[1].GetType(context)); foreach (var par in args[1].Elements) { retVal.Add( function.Evaluate( context, new EvaluationValue(par, args[1].GetType(context)))); } return new EvaluationValue(retVal, args[1].GetType(context)); }
/// <summary> /// Evaluates the function. /// </summary> /// <param name="context">The evaluation context instance.</param> /// <param name="args">The function arguments.</param> /// <returns>The result value of the function evaluation.</returns> public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } IDataType type = DataType; var bag = new BagValue(type); for (int i = 0; i < args.Length; i++) { bag.Add(args[i].GetTypedValue(type, i)); } return(new EvaluationValue(bag, type)); }