/// <summary> /// /// </summary> /// <returns></returns> public override object Clone() { TreeDictionary <K, V> clone = new TreeDictionary <K, V>(Comparer, EqualityComparer); clone.sortedpairs.AddSorted(sortedpairs); return(clone); }
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); }
public ISortedDictionary<int, int> BucketCostDistribution() { TreeDictionary<int, int> res = new TreeDictionary<int, int>(); #if LINEARPROBING int count = 0; #if REFBUCKET while (table[count] != null) #else while (!isnull(table[count].item)) #endif count++; for (int i = table.Length - 1; i >= 0; i--) { #if REFBUCKET if (table[i] != null) #else if (!isnull(table[i].item)) #endif count++; else count = 0; if (res.Contains(count)) res[count]++; else res[count] = 1; } return res; #else for (int i = 0, s = table.Length; i < s; i++) { int count = 0; #if REFBUCKET Bucket b = table[i]; while (b != null) { count++; b = b.overflow; } #else Bucket b = table[i]; if (!isnull(b.item)) { count = 1; OverflowBucket ob = b.overflow; while (ob != null) { count++; ob = ob.overflow; } } #endif if (res.Contains(count)) res[count]++; else res[count] = 1; } return res; #endif }