/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="blockSize">Capacity for strata estimator (good default is 80)</param>
 /// <param name="maxStrata">Maximum strate for the strata estimator.</param>
 /// <param name="configuration">The configuration</param>
 /// <param name="fixedBlockSize">When <c>true</c> the block size should not be modified, else the folding strategy can be applied.</param>
 public HybridEstimator(
     long blockSize,
     byte maxStrata,
     IInvertibleBloomFilterConfiguration <TEntity, TId, int, TCount> configuration,
     bool fixedBlockSize = false)
 {
     _strataEstimator = new StrataEstimator <TEntity, TId, TCount>(blockSize, configuration, maxStrata, fixedBlockSize: fixedBlockSize);
     _strataEstimator.DecodeCountFactor = _strataEstimator.BlockSize >= 20 ? 1.45D : 1.0D;
     _configuration = configuration;
 }
Exemple #2
0
        /// <summary>
        /// Compress the estimator.
        /// </summary>
        /// <param name="inPlace"></param>
        /// <returns></returns>
        public IStrataEstimator <TEntity, int, TCount> Compress(bool inPlace = false)
        {
            var res = Extract().Compress(Configuration);

            if (inPlace)
            {
                Rehydrate(res);
                return(this);
            }
            var estimator = new StrataEstimator <TEntity, TId, TCount>(res.BlockSize, Configuration, res.StrataCount);

            estimator.Rehydrate(res);
            return(estimator);
        }
Exemple #3
0
        /// <summary>
        /// Fold the strata estimator.
        /// </summary>
        /// <param name="factor"></param>
        /// <param name="inPlace"></param>
        /// <returns></returns>
        public virtual IStrataEstimator <TEntity, int, TCount> Fold(uint factor, bool inPlace = false)
        {
            var res = Extract().Fold(Configuration, factor);

            if (inPlace)
            {
                Rehydrate(res);
                return(this);
            }
            var strataEstimator = new StrataEstimator <TEntity, TId, TCount>(res.BlockSize, Configuration, res.StrataCount);

            strataEstimator.Rehydrate(res);
            return(strataEstimator);
        }