4using System.Reflection;
5using System.Threading.Tasks;
23 private static readonly MethodInfo findMethodGeneric = GetFindMethod();
43 private static MethodInfo GetFindMethod()
46 foreach (MethodInfo MI
in T.GetTypeInfo().GetDeclaredMethods(
"Find"))
48 ParameterInfo[] P = MI.GetParameters();
50 P[0].ParameterType != typeof(
int) ||
51 P[1].ParameterType != typeof(
int) ||
52 P[2].ParameterType != typeof(
Filter) ||
53 P[3].ParameterType != typeof(
string[]))
112 if (!(
Arguments[0].AssociatedObjectValue is Type T))
117 object FilterObj =
Arguments[3].AssociatedObjectValue;
121 string[] SortOrder =
new string[c];
123 for (i = 0; i < c; i++)
126 if (
Filter is
null && !(FilterObj is
null))
132 MethodInfo MI = findMethodGeneric.MakeGenericMethod(
new Type[] { T });
133 object Result = MI.Invoke(
null,
new object[] { Offset, MaxCount,
Filter, SortOrder });
136 if (Result is IEnumerable E)
158 else if (Node is
Or Or)
163 else if (Node is Operators.Dual.And And2)
166 await
this.ConvertAsync(And2.RightOperand,
Variables));
168 else if (Node is Operators.Dual.Or Or2)
171 await
this.ConvertAsync(Or2.RightOperand,
Variables));
177 KeyValuePair<string, object> P = await this.CheckBinaryOperator(EQ,
Variables);
182 KeyValuePair<string, object> P = await this.CheckBinaryOperator(NEQ,
Variables);
187 KeyValuePair<string, object> P = await this.CheckBinaryOperator(LT,
Variables);
192 KeyValuePair<string, object> P = await this.CheckBinaryOperator(GT,
Variables);
197 KeyValuePair<string, object> P = await this.CheckBinaryOperator(LTE,
Variables);
202 KeyValuePair<string, object> P = await this.CheckBinaryOperator(GTE,
Variables);
208 throw new ScriptRuntimeException(
"Middle operands in ternary filter operators need to be a variable references, as they refer to field names.",
this);
210 string FieldName = v.VariableName;
228 else if (Node is
Like)
247 throw new ScriptRuntimeException(
"Left operands in binary filter operators need to be a variable references, as they refer to field names.",
this);
249 return new KeyValuePair<string, object>(v.VariableName, (await Operator.RightOperand.EvaluateAsync(
Variables)).AssociatedObjectValue);
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static string WildcardToRegex(string s, string Wildcard)
Converts a wildcard string to a regular expression string.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
This filter selects objects that have a named field greater or equal to a given value.
This filter selects objects that have a named field greater than a given value.
This filter selects objects that have a named field lesser or equal to a given value.
This filter selects objects that have a named field lesser than a given value.
This filter selects objects that have a named field matching a given regular expression.
This filter selects objects that have a named field not equal to a given value.
Base class for all filter classes.
This filter selects objects that does not conform to the child-filter provided.
This filter selects objects that conform to any of the child-filters provided.
A chunked list is a linked list of chunks of objects of type T .
Base class for all types of elements.
Script runtime exception.
Class managing a script expression.
ScriptNode Root
Root script node.
static IElement Encapsulate(object Value)
Encapsulates an object.
static double ToDouble(object Object)
Converts an object to a double value.
static string ToExpressionString(object Value)
Converts an object to a string, that can be parsed as part of an expression.
Base class for all binary operators.
ScriptNode RightOperand
Right operand.
ScriptNode LeftOperand
Left operand.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
override string ToString()
static async Task< object > WaitPossibleTask(object Result)
Waits for any asynchronous process to terminate.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
virtual Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
ScriptNode MiddleOperand
Middle operand.
ScriptNode Operand
Operand.
Represents a variable reference.
Greater Than Or Equal To.
bool LeftInclusive
If the value specified by BinaryOperator.LeftOperand is included in the range.
bool RightInclusive
If the value specified by BinaryOperator.RightOperand is included in the range.
Finds objects in the object database.
override string[] DefaultArgumentNames
Default Argument names
override string FunctionName
Name of the function
override async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the function.
FindObjects(ScriptNode Type, ScriptNode Offset, ScriptNode MaxCount, ScriptNode Filter, ScriptNode SortOrder, int Start, int Length, Expression Expression)
Finds object in the object database.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
Basic interface for all types of elements.
Basic interface for vectors.
int Dimension
Dimension of vector.
IElement GetElement(int Index)
Gets an element of the vector.
ArgumentType
Type of parameter used in a function definition or a lambda definition.