private AggregationResult RemoveElementOnly(IFact fact, TKey key, TElement element) { var group = _groups[key]; group.Remove(fact, element); if (group.Count == 0) { return(AggregationResult.Removed(group)); } return(AggregationResult.Modified(group, group, group.Facts)); }
public IEnumerable <AggregationResult> Remove(AggregationContext context, ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var oldValue = _sourceToValue[fact]; _sourceToValue.Remove(fact); results.Add(AggregationResult.Removed(oldValue)); } return(results); }
private AggregationResult Remove(TKey key, TElement element) { var group = _groups[key]; group.Remove(element); if (group.Count == 0) { _groups.Remove(key); return(AggregationResult.Removed(group)); } return(AggregationResult.Modified(group)); }
public IEnumerable <AggregationResult> Remove(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var source = (TSource)fact.Value; var oldValue = _sourceToValue[source]; _sourceToValue.Remove(source); results.Add(AggregationResult.Removed(oldValue)); } return(results); }
public IEnumerable <AggregationResult> Remove(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var source = (TSource)fact.Value; var oldList = _sourceToList[source]; _sourceToList.Remove(source); foreach (var item in oldList) { results.Add(AggregationResult.Removed(item)); } } return(results); }
public IEnumerable <AggregationResult> Remove(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var oldList = _sourceToList[fact]; _sourceToList.Remove(fact); foreach (var item in oldList) { if (RemoveRef(item) == 0) { results.Add(AggregationResult.Removed(item)); } } } return(results); }
public IEnumerable <AggregationResult> Modify(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var source = (TSource)fact.Value; var value = (IEnumerable <TResult>)_selector.Invoke(tuple, fact); var list = new List <TResult>(value); var oldList = _sourceToList[source]; _sourceToList[source] = list; foreach (var item in oldList) { results.Add(AggregationResult.Removed(item)); } foreach (var item in list) { results.Add(AggregationResult.Added(item)); } } return(results); }
public IEnumerable <AggregationResult> Modify(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var list = new OrderedHashSet <TResult>(); var oldList = _sourceToList[fact]; _sourceToList[fact] = list; var value = (IEnumerable <TResult>)_selector.Invoke(tuple, fact); foreach (var item in value) { list.Add(item); } foreach (var item in oldList) { if (!list.Contains(item) && RemoveRef(item) == 0) { results.Add(AggregationResult.Removed(item)); } } foreach (var item in list) { if (oldList.Contains(item)) { results.Add(AggregationResult.Modified(item)); } else if (AddRef(item) == 1) { results.Add(AggregationResult.Added(item)); } } } return(results); }
public IEnumerable <AggregationResult> Modify(ITuple tuple, IEnumerable <IFact> facts) { var results = new List <AggregationResult>(); foreach (var fact in facts) { var source = (TSource)fact.Value; var value = _selector.Invoke(tuple, fact); var oldValue = (TResult)_sourceToValue[source]; _sourceToValue[source] = value; if (Equals(oldValue, value)) { results.Add(AggregationResult.Modified(value)); } else { results.Add(AggregationResult.Removed(oldValue)); results.Add(AggregationResult.Added(value)); } } return(results); }