private void CalculateAggregate(AggregateKey key) { ImmutableArray <Int32> columnMapping = ColumnDependencyMappings[key]; ImmutableArray <Int32> aggregateMapping = AggregateDependencyMappings[key]; AggregateValueBag aggregateBag = new AggregateValueBag(AggregateRow, aggregateMapping); Aggregate <TInput> aggregate = Aggregates[key]; Int32 aggregateIndex = AggregateIndexes[key]; AggregateRow[aggregateIndex] = aggregate.Calculate(aggregateBag, Rows.Select(row => new ColumnValueBag <TInput>(row, columnMapping))); }
private void CalculateColumn(ColumnKey key) { ImmutableArray <Int32> columnMapping = ColumnDependencyMappings[key]; ImmutableArray <Int32> aggregateMapping = AggregateDependencyMappings[key]; AggregateValueBag aggregateBag = new AggregateValueBag(AggregateRow, aggregateMapping); Column <TInput> column = Columns[key]; Int32 columnIndex = ColumnIndexes[key]; foreach (var row in Rows) { var bag = new ColumnValueBag <TInput>(row, columnMapping); row[columnIndex] = column.Calculate(aggregateBag, new ColumnValueBag <TInput>(row, columnMapping)); } }
public abstract Object Calculate(AggregateValueBag aggregateValues, ColumnValueBag <TInput> columnValues);
public abstract Object Calculate(AggregateValueBag aggregateValues, IEnumerable <ColumnValueBag <TInput> > rows);