/// <summary> /// Create filters /// </summary> /// <param name="estimatorData">Filter data to rehydrate.</param> private void CreateFilters(IStrataEstimatorData <int, TCount> estimatorData = null) { var configuration = Configuration.ConvertToEstimatorConfiguration(); HashFunctionCount = configuration.BestHashFunctionCount(BlockSize, ErrorRate); for (var idx = 0; idx < StrataFilters.Length; idx++) { if (idx >= MaxStrata) { StrataFilters[idx] = null; continue; } var filterData = estimatorData.GetFilterForStrata(idx); //lazily create Strata filters. StrataFilters[idx] = new Lazy <InvertibleBloomFilter <KeyValuePair <int, int>, int, TCount> >(() => { var res = new InvertibleBloomFilter <KeyValuePair <int, int>, int, TCount>(configuration); //capacity doesn't really matter, the capacity is basically the block size. res.Initialize(BlockSize, BlockSize, HashFunctionCount); res.Rehydrate(filterData); return(res); }); } }