/// <summary> /// Indicates that this resource is used by the given process /// </summary> /// <param name="process">The process.</param> /// <returns></returns> public void UsedBy(OrderedProcess process) { DependencyGraph.CheckGraph(this, process); if (users.Add(process)) { process.Requires(this); } }
/// <summary> /// Indicates that this process requires the specified resource. /// </summary> /// <param name="resource">The resource.</param> /// <returns>returns this process</returns> public void Requires(Resource resource) { DependencyGraph.CheckGraph(resource, this); if (_resources.Add(resource)) { resource.UsedBy(this); } }
/// <summary> /// Indicates that this process should execute before another /// </summary> /// <param name="follower">The ancestor.</param> /// <returns>returns this process</returns> public OrderedProcess Before(OrderedProcess follower) { DependencyGraph.CheckGraph(this, follower); if (_followers.Add(follower)) { follower.After(this); } return(follower); }
/// <summary> /// Indicates that this process should execute after another /// </summary> /// <param name="predecessor">The predecessor.</param> /// <returns>returns this process</returns> public OrderedProcess After(OrderedProcess predecessor) { DependencyGraph.CheckGraph(this, predecessor); if (_predecessors.Add(predecessor)) { predecessor.Before(this); } return(predecessor); }