Пример #1
0
        private static IEnumerable <ulong> GetSubFingerprintMatches(IReadOnlyList <int> hashes, int thresholdVotes, ReadOnlyTransaction tx)
        {
            var counter = new Dictionary <ulong, int>();

            for (var table = 0; table < hashes.Count; ++table)
            {
                var hashBin = hashes[table];
                var ids     = tx.GetSubFingerprintsByHashTableAndHash(table, hashBin);
                foreach (var id in ids)
                {
                    counter.TryGetValue(id, out var count);
                    counter[id] = count + 1;
                }
            }

            return(counter
                   .Where(pair => pair.Value >= thresholdVotes)
                   .Select(p => p.Key));
        }