Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OnDuration.cs
1using System.Threading.Tasks;
2using System.Xml;
5
7{
12 {
13 private ScriptableDurationAttribute value;
14
18 public OnDuration()
19 : base()
20 {
21 }
22
26 [DefaultValueNull]
27 public string ValueDefinition
28 {
29 get => this.value?.Definition;
30 set => this.value = new ScriptableDurationAttribute(value, this);
31 }
32
36 public override string LocalName => nameof(OnDuration);
37
42 public override IStateMachineNode Create()
43 {
44 return new OnDuration();
45 }
46
51 public override Task Parse(XmlElement Xml)
52 {
53 this.value = new ScriptableDurationAttribute(Xml.InnerText, this);
54
55 return base.Parse(Xml);
56 }
57
63 public override async Task<EventTimepoint> GetEventTimepoint(EvaluationArguments Arguments)
64 {
65 if (this.value is null)
66 return new EventTimepoint();
67 else
68 return new EventTimepoint(await this.value.Evaluate(Arguments.Variables));
69 }
70
74 public override string Label => this.value.Definition;
75 }
76}
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
Contains information required for evaluating script in a state-machine.
Event raised after a certain duration in the state.
Definition: OnDuration.cs:12
override async Task< EventTimepoint > GetEventTimepoint(EvaluationArguments Arguments)
Gets the timepoint for when the event elapses.
Definition: OnDuration.cs:63
override Task Parse(XmlElement Xml)
Parses the State-machine node.
Definition: OnDuration.cs:51
OnDuration()
Event raised after a certain duration in the state.
Definition: OnDuration.cs:18
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Definition: OnDuration.cs:42
Abstract base class for timed State-Machine event nodes.