public List <T> GetDependencies(int symbolId, DependencyDirection direction, DependencyLevel level) { if (symbolId < 0 || symbolId >= SymbolTable.Count) { throw new ArgumentException(nameof(symbolId)); } Digraph g = direction == DependencyDirection.Downstream ? Digraph : Digraph.Reverse(); IEnumerable <int> symbolIndexes; if (level == DependencyLevel.DirectOnly) { // That's easy symbolIndexes = g.GetAdjList(symbolId); } else { // Run BFS to find out var bfs = new DigraphBfs(g, symbolId); symbolIndexes = bfs.Preorder; } List <T> symbols = symbolIndexes .Select(i => Keys[i]) .ToList(); return(symbols); }
public List <T> GetDependencies(T symbol, DependencyDirection direction, DependencyLevel level) { if (!SymbolTable.ContainsKey(symbol)) { throw new ArgumentException(nameof(symbol)); } return(GetDependencies(SymbolTable[symbol], direction, level)); }
/// <summary> /// 增加依赖操作。 /// </summary> /// <param name="assetId">资源标识符</param> /// <param name="callback">加载完成后的回调</param> /// <param name="level">依赖等级</param> public void AddDependency <T>(string assetId, Action <T> callback, DependencyLevel level = DependencyLevel.Required) where T : UnityEngine.Object { var operation = AssetResolver.Deserialize <T>(assetId); operation.OnSucceed(() => { var result = (T)operation.Result; callback(result); }); AddDependency(operation, level); }
/// <summary> /// 增加依赖操作。 /// </summary> /// <param name="operation">操作</param> /// <param name="level">依赖等级</param> public void AddDependency(ILoadOperation operation, DependencyLevel level) { if (level == DependencyLevel.Required) { mRequires.Add(operation); } else if (level == DependencyLevel.Decorate) { mDecorations.Add(operation); } else if (level == DependencyLevel.Reference) { mReferences.Add(operation); } }
/// <summary> /// 获取指定依赖等级的加载操作。 /// </summary> /// <param name="level">依赖等级</param> /// <returns>操作</returns> public IEnumerable <ILoadOperation> GetDependencyOperations(DependencyLevel level) { if (level == DependencyLevel.Required) { return(mRequires); } if (level == DependencyLevel.Decorate) { return(mDecorations); } if (level == DependencyLevel.Reference) { return(mReferences); } throw new ArgumentException("level"); }
/// <summary> /// Initializes a new instance of the ExtensionDependencyAttribute class with the given type name and level. /// </summary> /// <remarks> /// The typename isn't checked but will be compare to the real typenames of existing extensions. /// </remarks> /// <param name="fullTypeName">The full type name of the Extension, your Extension depends on.</param> /// <param name="level">The level of the dependency.</param> public ExtensionDependencyAttribute(string fullTypeName, DependencyLevel level) { typeName = fullTypeName; this.level = level; }
public virtual void AddDepdendency(ITypeItem target, DependencyLevel level) { if (target.ID != ID) { var d = new Dependency(target, level); if (!_dependencies.Contains(d)) { _dependencies.Add(d); } } }
public List <DatabaseObject> GetDependencies(DatabaseObject databaseObject, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType = null) { if (!SymbolTable.ContainsKey(databaseObject)) { throw new ArgumentException(nameof(databaseObject)); } var items = GetDependencies(SymbolTable[databaseObject], direction, level); return(objectsType == null ? items : items.Where(w => w.ObjectType == objectsType).ToList()); }
public List <DatabaseObject> GetDependencies(int databaseObjectId, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType) { EnforceDatabaseObjectId(databaseObjectId); DatabaseObject databaseObject = Keys[databaseObjectId]; return(GetDependencies(databaseObject, direction, level, objectsType)); }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="DependencyLevel" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DependencyLevel.CreateFrom(sourceValue);
public IList <ViewModels.DatabaseObject> Get(int objectId, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType = null) { var items = _graph.GetDependencies(objectId, direction, level, objectsType); return(Mapper.Map <List <ViewModels.DatabaseObject> >(items)); }
public Dependency(ITypeItem target, DependencyLevel level) { Target = target; Level = level; }
public IList <ViewModels.Module> Get(int moduleId, DependencyDirection direction, DependencyLevel level) { var items = _graph.GetDependencies(moduleId, direction, level); return(Mapper.Map <List <ViewModels.Module> >(items)); }