Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Call.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Threading.Tasks;
5using Waher.Script;
6
8{
13 {
14 private IActivity activity;
15
22 : base(Parent, Model)
23 {
24 }
25
29 public override string LocalName => nameof(Call);
30
38 {
39 return new Call(Parent, Model);
40 }
41
45 public override Task Start()
46 {
47 if (!this.Model.TryGetActivity(this.Reference, out this.activity))
48 throw new Exception("Activity not found: " + this.Reference);
49
50 return base.Start();
51 }
52
58 public override async Task<LinkedListNode<IActivityNode>> Execute(Variables Variables)
59 {
60 await this.activity.ExecuteTask(Variables);
61 return null;
62 }
63
70 public override void ExportPlantUml(StreamWriter Output, int Indentation, char QuoteChar)
71 {
72 Indent(Output, Indentation);
73 Output.Write('(');
74 Output.Write(this.Reference);
75 Output.WriteLine(')');
76 }
77 }
78}
Root node of a simulation model
Definition: Model.cs:49
bool TryGetActivity(string Id, out IActivity Activity)
Tries to get a registered activity from the model.
Definition: Model.cs:388
Calls another activity.
Definition: Call.cs:13
override Task Start()
Starts the node.
Definition: Call.cs:45
Call(ISimulationNode Parent, Model Model)
Calls another activity.
Definition: Call.cs:21
override string LocalName
Local name of XML element defining contents of class.
Definition: Call.cs:29
override void ExportPlantUml(StreamWriter Output, int Indentation, char QuoteChar)
Exports PlantUML
Definition: Call.cs:70
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Definition: Call.cs:37
override async Task< LinkedListNode< IActivityNode > > Execute(Variables Variables)
Executes a node.
Definition: Call.cs:58
Base class for activity nodes with a reference.
static void Indent(StreamWriter Output, int Indentation)
Adds indentation to the current row.
Collection of variables.
Definition: Variables.cs:25
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
ISimulationNode Parent
Parent node in the simulation model.
Task ExecuteTask(Variables Variables)
Executes the activity.