public void AddAggregationEntries(IEnumerable <Field> fields, IEnumerable <Aggregation.Kinds> aggregationTypes) { List <FieldAggregationConfig> fieldAggregations = new List <FieldAggregationConfig>(); foreach (var field in fields) { FieldAggregationConfig aggrEntry = new FieldAggregationConfig(field, aggregationTypes); fieldAggregations.Add(aggrEntry); } this.AddAggregationEntries(fieldAggregations); }
// Initializes the object by specifying the aggregation types required. public FieldAggregator(FieldAggregationConfig fieldAggrConfig) { this.fieldAggrConfig = fieldAggrConfig; this.Clear(); // if the field type is a number it supports also the following types of aggregations if (this.fieldAggrConfig.Field.FieldKind != Field.Kind.Property) { // setting up aggregator types as booleans to make code slightly more efficient this.minimumEnabled = (Aggregation.Kinds.Minimum & this.fieldAggrConfig.AggregationTypesFlag) != 0; this.maximumEnabled = (Aggregation.Kinds.Maximum & this.fieldAggrConfig.AggregationTypesFlag) != 0; this.varianceEnabled = (Aggregation.Kinds.Variance & this.fieldAggrConfig.AggregationTypesFlag) != 0; this.averageEnabled = this.varianceEnabled || (Aggregation.Kinds.Average & this.fieldAggrConfig.AggregationTypesFlag) != 0; this.sumEnabled = this.averageEnabled || this.varianceEnabled || (Aggregation.Kinds.Sum & this.fieldAggrConfig.AggregationTypesFlag) != 0; } // and snapshot is is allowed to both types (metric, property) this.snapshotEnabled = (Aggregation.Kinds.Snapshot & this.fieldAggrConfig.AggregationTypesFlag) != 0; this.countEnabled = this.averageEnabled || this.varianceEnabled || (Aggregation.Kinds.Count & this.fieldAggrConfig.AggregationTypesFlag) != 0; }