Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GoTo.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Threading.Tasks;
5using Waher.Script;
6
8{
13 {
14 private LinkedListNode<IActivityNode> node;
15
22 : base(Parent, Model)
23 {
24 }
25
29 public LinkedListNode<IActivityNode> Node => this.node;
30
34 public override string LocalName => nameof(GoTo);
35
43 {
44 return new GoTo(Parent, Model);
45 }
46
50 public override Task Start()
51 {
52 if (!this.Model.TryGetActivityNode(this.Reference, out this.node))
53 throw new Exception("Activity node not found: " + this.Reference);
54
55 return base.Start();
56 }
57
63 public override Task<LinkedListNode<IActivityNode>> Execute(Variables Variables)
64 {
65 return Task.FromResult<LinkedListNode<IActivityNode>>(this.node);
66 }
67
74 public override void ExportPlantUml(StreamWriter Output, int Indentation, char QuoteChar)
75 {
76 Indent(Output, Indentation);
77 Output.Write('(');
78 Output.Write(this.Reference);
79 Output.WriteLine(')');
80
81 Indent(Output, Indentation);
82 Output.WriteLine("detach");
83 }
84 }
85}
Root node of a simulation model
Definition: Model.cs:49
bool TryGetActivityNode(string Id, out LinkedListNode< IActivityNode > ActivityNode)
Tries to get a registered activity node from the model.
Definition: Model.cs:416
Jumps to another node in the activity.
Definition: GoTo.cs:13
override void ExportPlantUml(StreamWriter Output, int Indentation, char QuoteChar)
Exports PlantUML
Definition: GoTo.cs:74
override Task Start()
Starts the node.
Definition: GoTo.cs:50
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Definition: GoTo.cs:42
GoTo(ISimulationNode Parent, Model Model)
Jumps to another node in the activity.
Definition: GoTo.cs:21
override string LocalName
Local name of XML element defining contents of class.
Definition: GoTo.cs:34
LinkedListNode< IActivityNode > Node
Referenced node
Definition: GoTo.cs:29
override Task< LinkedListNode< IActivityNode > > Execute(Variables Variables)
Executes a node.
Definition: GoTo.cs:63
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.