コード例 #1
0
        /// <summary>
        /// Gets the hash for the object.
        ///
        /// Once GetHash is called, no further writing is allowed.
        /// </summary>
        /// <returns>A hash of the object.</returns>
        public string GetHash()
        {
            if (!_isReadOnly)
            {
                _writer.WriteEndObject();
                _writer.Flush();

                _isReadOnly = true;
            }

            return(_hashFunc.GetHash());
        }
コード例 #2
0
        /// <summary>
        /// Gets the hash for the object.
        ///
        /// Once GetHash is called, no further writing is allowed.
        /// </summary>
        /// <returns>A hash of the object.</returns>
        public string GetHash()
        {
            ThrowIfDisposed();

            if (!_isReadOnly)
            {
                _writer.Flush();

                _isReadOnly = true;
            }

            return(_hashFunc.GetHash());
        }
コード例 #3
0
ファイル: HashMultiset.cs プロジェクト: kamaz08/Master
 public HashMultiset(MultisetAbstract <int> multiset, IHashFunction hashFunction, int k)
 {
     _hashFunction = hashFunction;
     _sortedSet    = new List <List <BigInteger> >();
     for (int i = 0; i < multiset.GetLength(); i += 1)
     {
         var m    = multiset.GetMultiset(i);
         var temp = new List <BigInteger>();
         m.ForEach(item =>
         {
             var hash = hashFunction.GetHash(item);
             if ((temp.Count() < k && !temp.Any(x => x == hash) || (temp.Count() >= k && temp[k - 1] > hash)))
             {
                 temp.Add(hash);
                 if (temp.Count() - k > 100)
                 {
                     temp = temp.OrderBy(x => x).Take(k).ToList();
                 }
             }
         });
         _sortedSet.Add(temp.OrderBy(x => x).Take(k).ToList());
     }
 }
コード例 #4
0
 // sending the line to the hash table
 public void Hashing(string line)
 {
     array[hashFunction.GetHash(line, hashDigit)].Push(line);
 }
コード例 #5
0
        /// <summary>
        /// Вставляет элемент в хэш-таблицу
        /// </summary>
        /// <param name="value">Элемент для добавления в таблицу</param>
        public void InsertElement(string value)
        {
            int number = Math.Abs(hashFunction.GetHash(value)) % HashTableSize;

            buckets[number].Insert(value);
        }