2using System.Threading.Tasks;
17 private readonly
In[] setConditions;
35 Sets.ImplicitSetDefinition.SeparateConditions(Conditions, out this.setConditions, out this.otherConditions);
45 IEnumerable<IElement> VectorElements;
46 bool CanEncapsulateAsMatrix;
48 if (this.
right is
null)
50 VectorElements =
null;
51 CanEncapsulateAsMatrix =
true;
56 CanEncapsulateAsMatrix = (E is
IMatrix);
59 if (VectorElements is
null)
64 this.setConditions, this.otherConditions,
Variables);
66 if (!(Elements is ICollection<IElement> Elements2))
87 IEnumerable<IElement> VectorElements;
88 bool CanEncapsulateAsMatrix;
90 if (this.
right is
null)
92 VectorElements =
null;
93 CanEncapsulateAsMatrix =
true;
98 CanEncapsulateAsMatrix = (E is
IMatrix);
101 if (VectorElements is
null)
106 this.setConditions, this.otherConditions,
Variables)
109 if (!(Elements is ICollection<IElement> Elements2))
137 if (!(this.setConditions?.
ForAllChildNodes(Callback, State, Order) ??
true))
140 if (!(this.otherConditions?.
ForAllChildNodes(Callback, State, Order) ??
true))
147 bool RecalcIsAsync =
false;
150 if (!(this.
left is
null))
152 b = !Callback(this.
left, out NewNode, State);
153 if (!(NewNode is
null))
158 RecalcIsAsync =
true;
161 if (b || (Order ==
SearchMethod.TreeOrder && !
this.left.ForAllChildNodes(Callback, State, Order)))
170 if (!(this.
right is
null))
172 b = !Callback(this.
right, out NewNode, State);
173 if (!(NewNode is
null))
175 this.right = NewNode;
178 RecalcIsAsync =
true;
181 if (b || (Order ==
SearchMethod.TreeOrder && !
this.right.ForAllChildNodes(Callback, State, Order)))
190 if (!(this.setConditions is
null))
192 for (i = 0, c = this.setConditions.Length; i < c; i++)
194 Node = this.setConditions[i];
197 b = !Callback(Node, out NewNode, State);
198 if (!(NewNode is
null) && NewNode is
In NewIn)
200 this.setConditions[i] = NewIn;
201 NewIn.SetParent(
this);
204 RecalcIsAsync =
true;
218 if (!(this.otherConditions is
null))
220 for (i = 0, c = this.otherConditions.Length; i < c; i++)
222 Node = this.otherConditions[i];
225 b = !Callback(Node, out NewNode, State);
226 if (!(NewNode is
null))
228 this.otherConditions[i] = NewNode;
229 NewNode.SetParent(
this);
232 RecalcIsAsync =
true;
257 if (!(this.setConditions?.
ForAllChildNodes(Callback, State, Order) ??
true))
260 if (!(this.otherConditions?.
ForAllChildNodes(Callback, State, Order) ??
true))
271 AreEqual(this.setConditions, O.setConditions) &&
272 AreEqual(this.otherConditions, O.otherConditions) &&
279 int Result = base.GetHashCode();
280 Result ^= Result << 5 ^
GetHashCode(this.setConditions);
281 Result ^= Result << 5 ^
GetHashCode(this.otherConditions);
A chunked list is a linked list of chunks of objects of type T .
Script runtime exception.
Class managing a script expression.
Base class for all binary operators.
virtual void CalcIsAsync()
Recalculates if operator is asynchronous or not.
ScriptNode right
Right operand.
ScriptNode left
Left operand.
bool isAsync
If subtree is asynchroneous.
Base class for all nodes in a parsed script tree.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, bool DepthFirst)
Calls the callback method for all child nodes.
int Length
Length of expression covered by node.
static bool AreEqual(ScriptNode S1, ScriptNode S2)
Compares if two script nodes are equal.
int Start
Start position in script expression.
void SetParent(ScriptNode Parent)
Sets the parent node. Can only be used when expression is being parsed or created.
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 ...
Represents an implicitly defined set
static async Task< IEnumerable< IElement > > CalculateElementsAsync(ScriptNode Pattern, IEnumerable< IElement > SuperSetElements, In[] SetConditions, ScriptNode[] OtherConditions, Variables Variables)
Calculates elements specified using implicit notation.
static IEnumerable< IElement > GetSetMembers(IElement E)
Gets the elements of a (supposed) set.
static IEnumerable< IElement > CalculateElements(ScriptNode Pattern, IEnumerable< IElement > SuperSetElements, In[] SetConditions, ScriptNode[] OtherConditions, Variables Variables)
Calculates elements specified using implicit notation.
Defines a vector, by implicitly limiting its members to members of an optional vector,...
override bool Equals(object obj)
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
ImplicitVectorDefinition(ScriptNode Pattern, ScriptNode Vector, ScriptNode[] Conditions, int Start, int Length, Expression Expression)
Defines a vector, by implicitly limiting its members to members of an optional vector,...
override int GetHashCode()
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Basic interface for all types of elements.
Basic interface for matrices.
delegate bool ScriptNodeEventHandler(ScriptNode Node, out ScriptNode NewNode, object State)
Delegate for ScriptNode callback methods.
SearchMethod
Method to traverse the expression structure