Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
EventVariables.cs
1using System;
3using Waher.Script;
4
6{
11 {
12 private readonly Variables modelVariables;
13
20 : base()
21 {
22 this.modelVariables = ModelVariables;
23
24 if (!(Actor is null))
25 this.Add("Actor", Actor.Variables);
26 }
27
31 public Variables ModelVariables => this.modelVariables;
32
38 public override bool ContainsVariable(string Name)
39 {
40 return base.ContainsVariable(Name) || this.modelVariables.ContainsVariable(Name);
41 }
42
49 public override bool TryGetVariable(string Name, out Variable Variable)
50 {
51 if (base.TryGetVariable(Name, out Variable))
52 return true;
53
54 if (this.modelVariables.TryGetVariable(Name, out Variable))
55 return true;
56
57 return false;
58 }
59
65 public override bool Remove(string VariableName)
66 {
67 if (base.Remove(VariableName))
68 return true;
69
70 if (this.modelVariables.Remove(VariableName))
71 return true;
72
73 return false;
74 }
75 }
76}
Abstract base class for actors
Definition: Actor.cs:15
override bool TryGetVariable(string Name, out Variable Variable)
Tries to get a variable object, given its name.
override bool Remove(string VariableName)
Removes a varaiable from the collection.
override bool ContainsVariable(string Name)
If the collection contains a variable with a given name.
EventVariables(Variables ModelVariables, IActor Actor)
Event variables
Contains information about a variable.
Definition: Variable.cs:10
Collection of variables.
Definition: Variables.cs:25
virtual Variable Add(string Name, object Value)
Adds a variable to the collection.
Definition: Variables.cs:122
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Definition: IActor.cs:11
Variables Variables
Collection of actor-variables.
Definition: IActor.cs:24