public override void Process(int matcherID, Element[] result)
        {
            var job = this.groupJobs[matcherID];

            if (result != null)
            {
                // Create a temporary row.
                job.resTable.temporaryRow = result;
                int rowPosition           = job.resTable.RowCount;
                TableResults.RowProxy row = job.resTable[rowPosition];
                var key = new GroupDictKey(job.hasher.Hash(in row), rowPosition); // It's a struct.
                AggregateBucketResult[] buckets = null;

                if (!job.groups.TryGetValue(key, out buckets))
                {
                    buckets = AggregateBucketResult.CreateBucketResults(aggregates);
                    job.groups.Add(key, buckets);
                    // Store the temporary row in the table. This causes copying of the row to the actual Lists of table.
                    // While the position of the stored row proxy remains the same, next time someone tries to access it,
                    // it returns the elements from the actual table and not the temporary row.
                    job.resTable.StoreTemporaryRow();
                    job.resTable.temporaryRow = null;
                }
                for (int j = 0; j < this.aggregates.Length; j++)
                {
                    this.aggregates[j].Apply(in row, buckets[j]);
                }
            }
            else
            {
                // If it runs in single thread. No need to merge the results.
                if (this.groupJobs.Length > 1)
                {
                    this.MergeResults(job, matcherID);
                }
            }
        }
示例#2
0
 public GroupProxyList(TableResults.RowProxy groupRepresentant, int index, AggregateListResults[] aggregatesResults)
 {
     this.groupRepresentant = groupRepresentant;
     this.index             = index;
     this.aggregatesResults = aggregatesResults;
 }
 public GroupProxyBucket(TableResults.RowProxy groupRepresentant, AggregateBucketResult[] aggregatesResults)
 {
     this.groupRepresentant = groupRepresentant;
     this.aggregatesResults = aggregatesResults;
 }
示例#4
0
 public RowProxyAccum(TableResults.RowProxy row, List <int> accum)
 {
     this.row           = row;
     this.accumulations = accum;
 }