Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JobTaskNode.cs
2using System.Threading.Tasks;
3using Waher.Groups;
5using Waher.Things;
6
8{
12 public abstract class JobTaskNode : JobNode, IGroup
13 {
17 public JobTaskNode()
18 {
19 }
20
26 public override Task<bool> AcceptsParentAsync(INode Parent)
27 {
28 return Task.FromResult(Parent is Job);
29 }
30
34 public async Task<T[]> FindNodes<T>()
35 where T : INode
36 {
37 ChunkedList<T> Nodes = new ChunkedList<T>();
38 await this.FindNodes(Nodes);
39 return Nodes.ToArray();
40 }
41
46 public async Task FindNodes<T>(ChunkedList<T> Nodes)
47 where T : INode
48 {
49 IEnumerable<INode> Children = await this.ChildNodes;
50 if (Children is null)
51 return;
52
53 foreach (INode Child in Children)
54 {
55 if (Child is T Typed)
56 Nodes.Add(Typed);
57 else if (Child is IGroup Group)
58 await Group.FindNodes(Nodes);
59 }
60 }
61
66 public abstract Task ExecuteTask(JobExecutionStatus Status);
67 }
68}
Contains information about the execution of a job.
Base class for all job nodes.
Definition: JobNode.cs:30
INode Parent
Parent Node, or null if a root node.
Definition: JobNode.cs:621
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.
Definition: JobNode.cs:695
Represents a job.
Definition: Job.cs:21
Abstract bast class for job tasks.
Definition: JobTaskNode.cs:13
async Task< T[]> FindNodes< T >()
Finds nodes referenced by the group node.
Definition: JobTaskNode.cs:34
abstract Task ExecuteTask(JobExecutionStatus Status)
Executes the task.
override Task< bool > AcceptsParentAsync(INode Parent)
If the node accepts a presumptive parent, i.e. can be added to that parent (if that parent accepts th...
Definition: JobTaskNode.cs:26
JobTaskNode()
Abstract bast class for job tasks.
Definition: JobTaskNode.cs:17
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
T[] ToArray()
Returns an array containing all elements of the collection.
Base Interface for all metering nodes.
Definition: IGroup.cs:11
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49