public virtual void SubtractAll(K1 key, IntCounter <K2> c) { IntCounter <K2> myInner = GetCounter(key); Counters.SubtractInPlace(myInner, c); total -= c.TotalIntCount(); }
public virtual void AddAll(K1 key, IntCounter <K2> c) { IntCounter <K2> myInner = GetCounter(key); Counters.AddInPlace(myInner, c); total += c.TotalIntCount(); }
/// <summary>replace the counter for K1-index o by new counter c</summary> public virtual IntCounter <K2> SetCounter(K1 o, IntCounter <K2> c) { IntCounter <K2> old = GetCounter(o); total -= old.TotalIntCount(); map[o] = c; total += c.TotalIntCount(); return(old); }
// it's empty, get rid of it! public virtual void Remove(K1 key) { IntCounter <K2> counter = map[key]; if (counter != null) { total -= counter.TotalIntCount(); } Sharpen.Collections.Remove(map, key); }
public virtual void AddAll(Edu.Stanford.Nlp.Stats.TwoDimensionalIntCounter <K1, K2> c) { foreach (K1 key in c.FirstKeySet()) { IntCounter <K2> inner = c.GetCounter(key); IntCounter <K2> myInner = GetCounter(key); Counters.AddInPlace(myInner, inner); total += inner.TotalIntCount(); } }
public virtual void SubtractAll(Edu.Stanford.Nlp.Stats.TwoDimensionalIntCounter <K1, K2> c, bool removeKeys) { foreach (K1 key in c.FirstKeySet()) { IntCounter <K2> inner = c.GetCounter(key); IntCounter <K2> myInner = GetCounter(key); Counters.SubtractInPlace(myInner, inner); if (removeKeys) { Counters.RetainNonZeros(myInner); } total -= inner.TotalIntCount(); } }
public virtual int TotalCount(K1 k1) { IntCounter <K2> c = GetCounter(k1); return(c.TotalIntCount()); }