public virtual void SetCount(K1 o1, K2 o2, int count) { IntCounter <K2> c = GetCounter(o1); int oldCount = GetCount(o1, o2); total -= oldCount; c.SetCount(o2, count); total += count; }
public virtual IntCounter <K1> TotalCounts() { IntCounter <K1> tc = new IntCounter <K1>(); foreach (K1 k1 in map.Keys) { tc.SetCount(k1, map[k1].TotalCount()); } return(tc); }
public virtual IntCounter <Pair <K1, K2> > Flatten() { IntCounter <Pair <K1, K2> > result = new IntCounter <Pair <K1, K2> >(); result.SetDefaultReturnValue(defaultValue); foreach (K1 key1 in FirstKeySet()) { IntCounter <K2> inner = GetCounter(key1); foreach (K2 key2 in inner.KeySet()) { result.SetCount(new Pair <K1, K2>(key1, key2), inner.GetIntCount(key2)); } } return(result); }