/// <summary> /// Fold the Bloom filter by the given factor. /// </summary> /// <param name="factor"></param> /// <param name="inPlace"></param> /// <returns></returns> public virtual BloomFilter <TEntity, TKey> Fold(uint factor, bool inPlace = false) { var result = _data.Fold(factor, inPlace); if (inPlace) { _capacity = _capacity / factor; _blockSize = result.Length; return(this); } var bloomFilter = new BloomFilter <TEntity, TKey>(_configuration); bloomFilter.Rehydrate(new BloomFilterData { Bits = result.ToBytes(), ItemCount = ItemCount, Capacity = _capacity / factor, BlockSize = result.Length, HashFunctionCount = _hashFunctionCount }); return(bloomFilter); }