public NameResolutionPath GetNameResolutionPath(LoadedLibrary systemLibrary) { if (_nameResolutionPath == null) { /* Depth first traversal, tracking level, add every unique required library at the level corresponding to the depth of the library in the dependency graph */ _nameResolutionPath = new NameResolutionPath(); GetNameResolutionPath(_nameResolutionPath, 0, this); /* Remove all levels with no libraries */ for (int index = _nameResolutionPath.Count - 1; index >= 0; index--) { if (_nameResolutionPath[index].Count == 0) { _nameResolutionPath.RemoveAt(index); } } /* Ensure that system is in the path */ if (!_nameResolutionPath.Contains(systemLibrary)) { _nameResolutionPath.Add(new Schema.LoadedLibraries()); _nameResolutionPath[_nameResolutionPath.Count - 1].Add(systemLibrary); } } return(_nameResolutionPath); }
protected void GetNameResolutionPath(NameResolutionPath path, int level, Schema.LoadedLibrary library) { while (path.Count <= level) { path.Add(new Schema.LoadedLibraries()); } if (!path.Contains(library)) { path[level].Add(library); } foreach (LoadedLibrary localLibrary in library.RequiredLibraries) { GetNameResolutionPath(path, level + 1, localLibrary); } }
public void ClearNameResolutionPath() { _nameResolutionPath = null; }