/// <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 inf.IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } BagValue retBag = new BagValue(DataType); inf.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 inf.IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } inf.IFunction function = DataType.SubsetFunction; if ((function.Evaluate( context, new EvaluationValue(args[0], args[0].GetType(context)), new EvaluationValue(args[1], args[1].GetType(context))) == EvaluationValue.True) && (function.Evaluate( context, new EvaluationValue(args[1], args[1].GetType(context)), new EvaluationValue(args[0], args[0].GetType(context))) == EvaluationValue.True)) { return(EvaluationValue.True); } else { return(EvaluationValue.False); } }
/// <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); EvaluationValue value = new EvaluationValue(args[1], args[1].GetType(context)); foreach (object par in args[2].Elements) { EvaluationValue retVal = function.Evaluate( context, value, new EvaluationValue(par, args[2].GetType(context))); if (retVal.BoolValue) { return(retVal); } } return(EvaluationValue.False); }
/// <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 inf.IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } inf.IFunction function = DataType.EqualFunction; foreach (object par1 in args[0].Elements) { foreach (object par2 in args[1].Elements) { EvaluationValue retVal = function.Evaluate( context, new EvaluationValue(par1, args[0].GetType(context)), new EvaluationValue(par2, args[1].GetType(context))); if (retVal.BoolValue) { return(EvaluationValue.True); } } } return(EvaluationValue.False); }
/// <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 inf.IFunctionParameter[] args) { if (context == null) { throw new ArgumentNullException("context"); } if (args == null) { throw new ArgumentNullException("args"); } if (args[1].IsBag) { inf.IFunction function = DataType.EqualFunction; foreach (object value in args[1].Elements) { if (function.Evaluate( context, new EvaluationValue(args[0], args[0].GetType(context)), new EvaluationValue(value, args[1].GetType(context))) == EvaluationValue.True) { return(EvaluationValue.True); } } } return(EvaluationValue.False); }
/// <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> /// 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 (function.Returns != DataTypeDescriptor.Boolean) { return(EvaluationValue.Indeterminate); } foreach (object par1 in args[1].Elements) { foreach (object par2 in args[2].Elements) { EvaluationValue retVal = function.Evaluate( context, new EvaluationValue(par1, args[1].GetType(context)), new EvaluationValue(par2, args[2].GetType(context))); if (!retVal.BoolValue) { return(EvaluationValue.False); } } } return(EvaluationValue.True); }
/// <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); foreach (object par1 in args[1].Elements) { bool hasFound = false; foreach (object par2 in args[2].Elements) { EvaluationValue retVal = function.Evaluate( context, new EvaluationValue(par1, args[1].GetType(context)), new EvaluationValue(par2, args[2].GetType(context))); if (retVal.BoolValue) { hasFound = true; break; } } if (!hasFound) { return(EvaluationValue.False); } } return(EvaluationValue.True); }