private void AddImportedFunctions(string library, IEnumerable <FunctionDescriptor> functions) { if (null == library || null == functions) { throw new ArgumentNullException(); } Dictionary <string, FunctionGroup> fptrs; if (!importedFunctionGroups.TryGetValue(library, out fptrs)) { fptrs = new Dictionary <string, FunctionGroup>(); importedFunctionGroups[library] = fptrs; } foreach (FunctionDescriptor function in functions) { string qualifiedName = function.QualifiedName; FunctionGroup functionGroup; if (!fptrs.TryGetValue(qualifiedName, out functionGroup)) { functionGroup = new FunctionGroup(qualifiedName); fptrs[qualifiedName] = functionGroup; } functionGroup.AddFunctionDescriptor(function); } }
private void AddBuiltinFunctions(IEnumerable <FunctionDescriptor> functions) { if (null == functions) { throw new ArgumentNullException(); } foreach (FunctionDescriptor function in functions) { string qualifiedName = function.QualifiedName; if (CoreUtils.StartsWithDoubleUnderscores(qualifiedName)) { continue; } FunctionGroup functionGroup; if (!builtinFunctionGroups.TryGetValue(qualifiedName, out functionGroup)) { functionGroup = new FunctionGroup(qualifiedName); builtinFunctionGroups[qualifiedName] = functionGroup; } functionGroup.AddFunctionDescriptor(function); } }
private static bool TryGetFunctionGroup( Dictionary <string, FunctionGroup> funcGroupMap, string qualifiedName, out FunctionGroup funcGroup) { if (funcGroupMap.TryGetValue(qualifiedName, out funcGroup)) { return(true); } string[] partialName = qualifiedName.Split('.'); string key = funcGroupMap.Keys.FirstOrDefault(k => CanbeResolvedTo(partialName, k.Split('.'))); if (key != null) { funcGroup = funcGroupMap[key]; return(true); } return(false); }
private void AddZeroTouchNodeToSearch(FunctionGroup funcGroup) { foreach (var functionDescriptor in funcGroup.Functions) { AddZeroTouchNodeToSearch(functionDescriptor); } }