Пример #1
0
        //TODO: put in interface
        /// <summary>
        /// Make a snapshot of the current state of this dictionary
        /// </summary>
        /// <returns>The snapshot</returns>
        public SCG.IEnumerable <KeyValuePair <K, V> > Snapshot()
        {
            TreeDictionary <K, V> res = (TreeDictionary <K, V>)MemberwiseClone();

            res.pairs = (TreeSet <KeyValuePair <K, V> >)((TreeSet <KeyValuePair <K, V> >)sortedpairs).Snapshot();
            return(res);
        }
Пример #2
0
        /// <summary>
        /// Produce statistics on distribution of bucket sizes. Current implementation is incomplete.
        /// </summary>
        /// <returns>Histogram data.</returns>
        public ISortedDictionary <int, int> BucketCostDistribution()
        {
            TreeDictionary <int, int> res = new TreeDictionary <int, int>();

            for (int i = 0, s = table.Length; i < s; i++)
            {
                int    count = 0;
                Bucket b     = table[i];

                while (b != null)
                {
                    count++;
                    b = b.overflow;
                }
                if (res.Contains(count))
                {
                    res[count]++;
                }
                else
                {
                    res[count] = 1;
                }
            }

            return(res);
        }