public TaskRunner(IPlugin plugin, DependentNode node, DataStore resultData, DataStore staticData, PipelineExecutor pipe, int run) { this.plugin = plugin; this.node = node; this.resultData = resultData; this.staticData = staticData; executor = pipe; this.run = run; }
/// <summary> /// Returns the nodeSlot that is linked to the search node's given slot in its dependencies /// </summary> /// <param name="searchNode">node to look through</param> /// <param name="dependencyGraph">nodes in graph</param> /// <param name="searchSlot">slot that other node links to</param> /// <returns>node slot that points to the node that is linked to the search nodes search slot</returns> public static NodeSlot FindFirstNodeSlotInDependencies(DependentNode searchNode, Dictionary <int, DependentNode> dependencyGraph, int searchSlot) { foreach (NodeSlot slot in searchNode.Dependencies) { if (OtherNodeSlotDependents(dependencyGraph[slot.NodeId], searchNode.Id) == searchSlot) { return(slot); } } return(NodeSlot.Invalid); }
public static int OtherNodeSlotDependencies(DependentNode node, int targetNodeId) { foreach (NodeSlot slot in node.Dependencies) { if (slot.NodeId == targetNodeId) { return(slot.SlotPos); } } return(-1); }
/// <summary> /// Returns the nodeSlot that is linked to the search node's given slot in its dependencies /// </summary> /// <param name="searchNode">node to look through</param> /// <param name="dependencyGraph">nodes in graph</param> /// <param name="searchSlot">slot that other node links to</param> /// <returns>node slots that points to the node that is linked to the search nodes search slot</returns> public static NodeSlot[] FindAllNodeSlotsInDependents(DependentNode searchNode, Dictionary <int, DependentNode> dependencyGraph, int searchSlot) { List <NodeSlot> slots = new List <NodeSlot>(); foreach (NodeSlot slot in searchNode.Dependents) { if (OtherNodeSlotDependencies(dependencyGraph[slot.NodeId], searchNode.Id) == searchSlot) { slots.Add(slot); } } return(slots.ToArray()); }
public static bool HasFulfilledDependency(DependentNode node, DataStore pipelineData, DataStore staticData) { foreach (NodeSlot id in node.Dependencies) { if (pipelineData.getData(id) == null && staticData.getData(id) == null && staticData.getSyncData(id) == null) { return(false); } } return(true); }
/// <summary> /// Triggers the dependencies of a node for execution /// </summary> /// <param name="targetId">Node that is needs its dependencies triggered</param> public void TriggerDependencies(int targetId) { //start the next set of tasks List <int> ids = new List <int>(); DependentNode targetNode = dependencyGraph[targetId]; for (int i = 0; i < targetNode.Dependents.Length; i++) { if (!ids.Contains(targetNode.Dependents[i].NodeId)) { ids.Add(targetNode.Dependents[i].NodeId); } } StartNodes(ids.ToArray(), targetId); GC.Collect(); }