/// <returns>the inner Counter associated with key o</returns> public virtual IntCounter <K2> GetCounter(K1 o) { IntCounter <K2> c = map[o]; if (c == null) { c = new IntCounter <K2>(innerMF); c.SetDefaultReturnValue(defaultValue); map[o] = c; } return(c); }
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); }