/// <summary> /// Called by the Inference Engine whenever an Individual predicate is found in the /// rule base and must be evaluated to determine if it is a function. /// </summary> /// <param name="individual">The Individual found in the rule base.</param> /// <returns>The unchanged Individual if it is not a function, else a Function predicate.</returns> public IPredicate AnalyzeIndividualPredicate(Individual individual) { if (individual.Value is string) { // Match the regular expression pattern against a text string. Match m = RegexFunction.Match((string)individual.Value); if (m.Success) { // Create a function predicate with ArrayList arguments = new ArrayList(); foreach (Capture c2 in m.Groups[2].Captures) { arguments.Add(c2.ToString().Trim()); } return(new Function(Function.FunctionResolutionType.Binder, (string)individual.Value, this, m.Groups[1].Captures[0].ToString(), (string[])arguments.ToArray(typeof(string)))); } } return(individual); }