Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Intersection.cs
1using System;
2using System.Threading.Tasks;
7
9{
14 {
24 : base(Left, Right, Start, Length, Expression)
25 {
26 }
27
34 {
35 IElement L = this.left.Evaluate(Variables);
36 if (!(L is ISet S1))
37 S1 = new FiniteSet(new IElement[] { L });
38
39 IElement R = this.right.Evaluate(Variables);
40 if (!(R is ISet S2))
41 S2 = new FiniteSet(new IElement[] { R });
42
43 return new IntersectionSet(S1, S2);
44 }
45
51 public override async Task<IElement> EvaluateAsync(Variables Variables)
52 {
53 if (!this.isAsync)
54 return this.Evaluate(Variables);
55
56 IElement L = await this.left.EvaluateAsync(Variables);
57 if (!(L is ISet S1))
58 S1 = new FiniteSet(new IElement[] { L });
59
60 IElement R = await this.right.EvaluateAsync(Variables);
61 if (!(R is ISet S2))
62 S2 = new FiniteSet(new IElement[] { R });
63
64 return new IntersectionSet(S1, S2);
65 }
66 }
67}
Class managing a script expression.
Definition: Expression.cs:39
Base class for all binary operators.
ScriptNode right
Right operand.
ScriptNode left
Left operand.
bool isAsync
If subtree is asynchroneous.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
abstract IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
virtual Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
Definition: ScriptNode.cs:158
Represents a finite set.
Definition: FiniteSet.cs:13
Represents a Intersection of two sets.
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Intersection.cs:51
Intersection(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Intersection operator.
Definition: Intersection.cs:23
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Intersection.cs:33
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for all types of sets.
Definition: ISet.cs:10