3using System.Threading.Tasks;
17 private readonly KeyValuePair<string, ScriptNode>[] additionalFields;
18 private readonly
bool[] additionalFieldAsynchronous;
21 private readonly
int count;
22 private readonly
bool isAsynchronous;
33 KeyValuePair<string, int>[] AdditionalFields,
ScriptNode[] Columns)
35 this.processor = Processor;
38 this.count = AdditionalFields.Length;
40 this.additionalFieldAsynchronous =
new bool[this.count];
41 this.additionalFields =
new KeyValuePair<string, ScriptNode>[this.count];
44 for (
int i = 0; i < this.count; i++)
46 KeyValuePair<string, int> P = AdditionalFields[i];
49 this.additionalFields[i] =
new KeyValuePair<string, ScriptNode>(P.Key, Node);
52 this.isAsynchronous =
true;
68 KeyValuePair<string, ScriptNode> P;
71 if (this.objectVariables is
null)
74 this.objectVariables.Object = Object;
78 for (i = 0; i < this.count; i++)
80 P = this.additionalFields[i];
81 GenObj[P.Key] = P.Value.Evaluate(this.objectVariables);
86 for (i = 0; i < this.count; i++)
88 P = this.additionalFields[i];
89 GroupObj[P.Key] = P.Value.Evaluate(this.objectVariables);
95 Array.Empty<
ScriptNode>(),
this.objectVariables);
97 for (i = 0; i < this.count; i++)
99 P = this.additionalFields[i];
100 Obj[P.Key] = P.Value.Evaluate(this.objectVariables);
106 return this.processor.Process(Object);
116 KeyValuePair<string, ScriptNode> P;
119 if (this.objectVariables is
null)
122 this.objectVariables.Object = Object;
126 for (i = 0; i < this.count; i++)
128 P = this.additionalFields[i];
130 if (this.additionalFieldAsynchronous[i])
131 GenObj[P.Key] = await P.Value.EvaluateAsync(this.objectVariables);
133 GenObj[P.Key] = P.Value.Evaluate(this.objectVariables);
138 for (i = 0; i < this.count; i++)
140 P = this.additionalFields[i];
142 if (this.additionalFieldAsynchronous[i])
143 GroupObj[P.Key] = await P.Value.EvaluateAsync(this.objectVariables);
145 GroupObj[P.Key] = P.Value.Evaluate(this.objectVariables);
151 Array.Empty<
ScriptNode>(),
this.objectVariables);
153 for (i = 0; i < this.count; i++)
155 P = this.additionalFields[i];
157 if (this.additionalFieldAsynchronous[i])
158 Obj[P.Key] = await P.Value.EvaluateAsync(this.objectVariables);
160 Obj[P.Key] = P.Value.Evaluate(this.objectVariables);
166 return await this.processor.ProcessAsync(Object);
173 public bool Flush() => this.processor.Flush();
179 public Task<bool>
FlushAsync() => this.processor.FlushAsync();
Generic object. Contains a sequence of properties.
Base class for all nodes in a parsed script tree.
virtual bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
Represents a collection of objects grouped together useing a GROUP BY construct.
Processor that adds fields to processed items.
bool Flush()
Called at the end of processing, to allow for flushing of buffers, etc.
bool IsAsynchronous
If the processor operates asynchronously.
Task< bool > FlushAsync()
Called at the end of processing, to allow for flushing of buffers, etc.
FieldAggregatorProcessor(IProcessor< object > Processor, Variables Variables, KeyValuePair< string, int >[] AdditionalFields, ScriptNode[] Columns)
Processor that adds fields to processed items.
async Task< bool > ProcessAsync(object Object)
Processes an object asynchronously.
bool Process(object Object)
Processes an object synchronously.
Interface for processors of objects.
bool IsAsynchronous
If the processor operates asynchronously.
Basic interface for all types of elements.