Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Argument.cs
1using System;
2using System.Threading.Tasks;
3using System.Xml;
6
8{
13 {
14 private IValue value = null;
15 private string name;
16
23 : base(Parent, Model)
24 {
25 }
26
35 : base(Parent, Model)
36 {
37 this.name = Name;
38 this.AddChild(new Script(this, Model, Value));
39 }
40
48 public Argument(ISimulationNode Parent, Model Model, string Name, System.DateTime Value)
49 : base(Parent, Model)
50 {
51 this.name = Name;
52 this.AddChild(new Values.DateTime(this, Model, Value));
53 }
54
63 : base(Parent, Model)
64 {
65 this.name = Name;
66 this.AddChild(new Duration(this, Model, Value));
67 }
68
77 : base(Parent, Model)
78 {
79 this.name = Name;
80 this.AddChild(new Number(this, Model, Value));
81 }
82
91 : base(Parent, Model)
92 {
93 this.name = Name;
94 this.AddChild(new Values.String(this, Model, Value));
95 }
96
105 : base(Parent, Model)
106 {
107 this.name = Name;
108 this.AddChild(new Time(this, Model, Value));
109 }
110
114 public override string LocalName => nameof(Argument);
115
119 public string Name => this.name;
120
124 public IValue Value => this.value;
125
133 {
134 return new Argument(Parent, Model);
135 }
136
141 public override Task FromXml(XmlElement Definition)
142 {
143 this.name = XML.Attribute(Definition, "name");
144
145 return base.FromXml(Definition);
146 }
147
152 public void Register(IValue Value)
153 {
154 if (this.value is null)
155 this.value = Value;
156 else
157 throw new Exception("Argument already has a value defined.");
158 }
159
160 }
161}
Root node of a simulation model
Definition: Model.cs:49
Defines an argument in an action.
Definition: Argument.cs:13
void Register(IValue Value)
Registers a value for the argument.
Definition: Argument.cs:152
override string LocalName
Local name of XML element defining contents of class.
Definition: Argument.cs:114
Argument(ISimulationNode Parent, Model Model, string Name, string Value)
Defines an argument in an action.
Definition: Argument.cs:90
Argument(ISimulationNode Parent, Model Model, string Name, System.DateTime Value)
Defines an argument in an action.
Definition: Argument.cs:48
Argument(ISimulationNode Parent, Model Model, string Name, TimeSpan Value)
Defines an argument in an action.
Definition: Argument.cs:104
Argument(ISimulationNode Parent, Model Model, string Name, Waher.Content.Duration Value)
Defines an argument in an action.
Definition: Argument.cs:62
override Task FromXml(XmlElement Definition)
Sets properties and attributes of class in accordance with XML definition.
Definition: Argument.cs:141
Argument(ISimulationNode Parent, Model Model, string Name, double Value)
Defines an argument in an action.
Definition: Argument.cs:76
string Name
Name of variable within the scope of the event.
Definition: Argument.cs:119
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Definition: Argument.cs:132
Argument(ISimulationNode Parent, Model Model, string Name, Waher.Script.Expression Value)
Defines an argument in an action.
Definition: Argument.cs:34
Argument(ISimulationNode Parent, Model Model)
Defines an argument in an action.
Definition: Argument.cs:22
Abstract base class for simulation nodes with children
void AddChild(ISimulationNode Child)
Adds a child node.
ISimulationNode Parent
Parent node in the simulation model.
Value defined by script.
Definition: Script.cs:13
Abstract base class for values
Definition: Value.cs:11
Helps with common XML-related tasks.
Definition: XML.cs:19
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition: XML.cs:914
Class managing a script expression.
Definition: Expression.cs:39
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Interface for nodes holding a value node
Definition: App.xaml.cs:4
Represents a duration value, as defined by the xsd:duration data type: http://www....
Definition: Duration.cs:13