Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Calc.cs
1using System.Threading.Tasks;
2using System.Xml;
5
7{
11 public class Calc : ValueNode
12 {
13 private ExpressionAttribute expression;
14
18 public Calc()
19 : base()
20 {
21 }
22
26 [DefaultValueNull]
27 public string Expression
28 {
29 get => this.expression?.Expression;
30 set => this.expression = new ExpressionAttribute(value, false, this);
31 }
32
36 public override string LocalName => nameof(Calc);
37
42 public override IStateMachineNode Create()
43 {
44 return new Calc();
45 }
46
51 public override Task Parse(XmlElement Xml)
52 {
53 this.expression = new ExpressionAttribute(Xml.InnerText, true, this);
54
55 return base.Parse(Xml);
56 }
57
62 public override Task<object> Evaluate(EvaluationArguments Arguments)
63 {
64 return this.expression?.Evaluate(Arguments.Variables) ?? Task.FromResult<object>(null);
65 }
66 }
67}
async Task< object > Evaluate(Variables Variables)
Evaluates the attribute
Contains information required for evaluating script in a state-machine.
override Task Parse(XmlElement Xml)
Parses the State-machine node.
Definition: Calc.cs:51
override Task< object > Evaluate(EvaluationArguments Arguments)
Evaluates the value node.
Definition: Calc.cs:62
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Definition: Calc.cs:42
Abstract base class for State-Machine nodes containing a value.
Definition: ValueNode.cs:9