示例#1
0
        private IChangeSet <T> UpdateResultList(IChangeSet <T> changes)
        {
            //child caches have been updated before we reached this point.
            changes.Flatten().ForEach(change =>
            {
                var item             = change.Current;
                var isInResult       = _resultList.Contains(item);
                var shouldBeInResult = MatchesConstraint(item);

                if (shouldBeInResult)
                {
                    if (!isInResult)
                    {
                        _resultList.Add(item);
                    }
                }
                else
                {
                    if (isInResult)
                    {
                        _resultList.Remove(item);
                    }
                }
            });
            return(_resultList.CaptureChanges());
        }
示例#2
0
        private IChangeSet <T> UpdateResultList(IChangeSet <T> changes, List <ReferenceCountTracker <T> > sourceLists, ChangeAwareListWithRefCounts <T> resultList)
        {
            //child caches have been updated before we reached this point.
            foreach (var change in changes.Flatten())
            {
                var item             = change.Current;
                var isInResult       = resultList.Contains(item);
                var shouldBeInResult = MatchesConstraint(sourceLists, item);

                if (shouldBeInResult)
                {
                    if (!isInResult)
                    {
                        resultList.Add(item);
                    }
                }
                else
                {
                    if (isInResult)
                    {
                        resultList.Remove(item);
                    }
                }
            }
            return(resultList.CaptureChanges());
        }
示例#3
0
 private IChangeSet <T> ProcessChanges(MergeContainer[] sourceLists, ChangeAwareListWithRefCounts <T> resultingList, IEnumerable <T> items)
 {
     //check whether the item should be removed from the list
     items.ForEach(item => { ProcessItem(sourceLists, resultingList, item); });
     return(resultingList.CaptureChanges());
 }
示例#4
0
 private IChangeSet <T> UpdateResultList(MergeContainer[] sourceLists, ChangeAwareListWithRefCounts <T> resultingList, IChangeSet <T> changes)
 {
     //child caches have been updated before we reached this point.
     changes.Flatten().ForEach(change => { ProcessItem(sourceLists, resultingList, change.Current); });
     return(resultingList.CaptureChanges());
 }