Esempio n. 1
0
 public void AddOrMerge(MultiReadResult <TKey, TEntry> result)
 {
     foreach (var item in result)
     {
         AddOrMerge(item);
     }
 }
Esempio n. 2
0
 public MultiReadResult <TKey, TEntry> MergeInto(MultiReadResult <TKey, TEntry> other)
 {
     foreach (var otherResult in other)
     {
         var thisResult = FindResult(otherResult.Key);
         otherResult.MergeWith(thisResult);
     }
     return(this);
 }
Esempio n. 3
0
 public MultiReadResult <TKey, TEntry> MergeWith(MultiReadResult <TKey, TEntry> other)
 {
     foreach (var thisResult in this)
     {
         var otherResult = other.FindResult(thisResult.Key);
         thisResult.MergeWith(otherResult);
     }
     return(this);
 }
Esempio n. 4
0
        public static MultiReadResult <TKey, TEntry> Combine <TKey, TEntry>(this IEnumerable <MultiReadResult <TKey, TEntry> > that)
            where TEntry : IEntry
        {
            var result = new MultiReadResult <TKey, TEntry>();

            foreach (var item in that)
            {
                result.AddOrMerge(item);
            }
            return(result);
        }
Esempio n. 5
0
        public static MultiReadResult <TKey, TEntry> Combine <TKey, TEntry>(this IEnumerable <MultiReadResult <TKey, TEntry> > that, int count)
            where TEntry : IEntry
        {
            if (count == 1)
            {
                return(that.First());
            }

            var dictionary = CreateDictionary(that.SelectMany(x => x));
            var result     = new MultiReadResult <TKey, TEntry>();

            foreach (var kvp in dictionary)
            {
                var key        = kvp.Key;
                var values     = kvp.Value;
                var sort       = values[0].Sort;
                var readResult = new ReadResult <TKey, TEntry>(key, sort, values);
                result.AddResult(readResult);
            }
            return(result);
        }