37 return this.ConvertToVector(
Operand);
58 return ToVector2.ToVector();
71 if (!(CheckAgainst is
IVector Vector))
73 Vector = this.ConvertToVector(CheckAgainst) as
IVector;
81 Dictionary<string, PatternRec> VariableNames =
null;
89 if (VariableNames is
null)
90 VariableNames =
new Dictionary<string, PatternRec>();
92 if (!VariableNames.ContainsKey(Ref2.VariableName))
94 if (AlreadyFound.TryGetValue(Ref2.VariableName, out IElement E))
96 VariableNames[Ref2.VariableName] = new PatternRec()
104 VariableNames[Ref2.VariableName] = new PatternRec()
106 New = new ChunkedList<IElement>(),
118 switch (this.op.PatternMatch(
Element, AlreadyFound))
121 if (!(VariableNames is
null))
123 foreach (KeyValuePair<string, PatternRec> P
in VariableNames)
125 if (!(P.Value.New is
null))
127 if (AlreadyFound.TryGetValue(P.Key, out
IElement E))
130 AlreadyFound.Remove(P.Key);
148 if (!(VariableNames is
null))
150 foreach (KeyValuePair<string, PatternRec> P
in VariableNames)
152 if (!(P.Value.New is
null))
153 AlreadyFound[P.Key] = VectorDefinition.Encapsulate(P.Value.New,
false,
this);
160 private class PatternRec
166 #region IIterativeEvaluation
171 public bool CanEvaluateIteratively =>
true;
A chunked list is a linked list of chunks of objects of type T .
Base class for all types of elements.
Class managing a script expression.
Base class for all unary operators performing operand null checks.
bool NullCheck
If null check is to be used.
readonly bool nullCheck
If null should be returned if operand is null.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
virtual PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
int Start
Start position in script expression.
ScriptNode Operand
Operand.
override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
Represents a variable reference.
static readonly ObjectValue Null
Null value.
ToVector(v) iterative evaluator
override IElement Evaluate(IElement Operand, Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
IIterativeEvaluator CreateEvaluator()
Creates an iterative evaluator for the node.
override PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
ToVector(ScriptNode Operand, bool NullCheck, int Start, int Length, Expression Expression)
To-Vector operator.
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
Basic interface for vectors.
Basic interface for all types of module elements.
Basic interface for all types of sets.
A function that can be iteratively evaluated, meaning it can be iteratively computed one element at a...
An interative evaluator of a function supporting the IIterativeEvaluation interface.
Interface for objects that can be converted into matrices.
PatternMatchResult
Status result of a pattern matching operation.
SearchMethod
Method to traverse the expression structure