public override void PropagateRetract(IExecutionContext context, IList <Tuple> tuples) { var aggregation = new Aggregation(); foreach (var tuple in tuples) { IFactAggregator aggregator = RemoveFactAggregator(tuple); if (aggregator != null) { aggregation.Remove(tuple, aggregator.AggregateFacts); } } PropagateAggregation(context, aggregation); }
public override void PropagateRetract(IExecutionContext context, List <Tuple> tuples) { var aggregation = new Aggregation(); using (var counter = PerfCounter.Retract(context, this)) { foreach (var tuple in tuples) { IFactAggregator aggregator = RemoveFactAggregator(context, tuple); if (aggregator != null) { aggregation.Remove(tuple, aggregator.AggregateFacts); } } counter.AddInputs(tuples.Count); counter.AddOutputs(aggregation.Count); } PropagateAggregation(context, aggregation); }
private void AddAggregationResult(Aggregation aggregation, Tuple tuple, IEnumerable <AggregationResult> results) { foreach (var result in results) { switch (result.Action) { case AggregationAction.Added: var addedFact = CreateAggregateFact(result.Aggregate); aggregation.Add(tuple, addedFact); break; case AggregationAction.Modified: var modifiedFact = GetAggregateFact(result.Aggregate, result.Previous); aggregation.Modify(tuple, modifiedFact); break; case AggregationAction.Removed: var removedFact = RemoveAggregateFact(result.Aggregate); aggregation.Remove(tuple, removedFact); break; } } }
private void ResetAggregator(Aggregation aggregation, Tuple tuple, IFactAggregator aggregator) { tuple.RemoveState <IFactAggregator>(this); aggregation.Remove(tuple, aggregator.AggregateFacts); }
private void ResetAggregator(IExecutionContext context, Aggregation aggregation, Tuple tuple, IFactAggregator aggregator) { context.WorkingMemory.RemoveState <IFactAggregator>(this, tuple); aggregation.Remove(tuple, aggregator.AggregateFacts); }