コード例 #1
0
ファイル: MultiReadResult.cs プロジェクト: samhu70/Tsdb-1
 public void AddOrMerge(MultiReadResult <TKey, TEntry> result)
 {
     foreach (var item in result)
     {
         AddOrMerge(item);
     }
 }
コード例 #2
0
ファイル: MultiReadResult.cs プロジェクト: samhu70/Tsdb-1
 public MultiReadResult <TKey, TEntry> MergeInto(MultiReadResult <TKey, TEntry> other)
 {
     foreach (var otherResult in other)
     {
         var thisResult = FindResult(otherResult.Key);
         otherResult.MergeWith(thisResult);
     }
     return(this);
 }
コード例 #3
0
ファイル: MultiReadResult.cs プロジェクト: samhu70/Tsdb-1
 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);
 }
コード例 #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);
        }
コード例 #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);
        }