public static <T1, T2> void save2DCounterSorted(TwoDimensionalCounterInterface<T1, T2> tdc, String filename) throws IOException { PrintWriter out = new PrintWriter(new FileWriter(filename)); for (T1 outer : tdc.firstKeySet()) { Counter<T2> c = tdc.getCounter(outer); List<T2> keys = Counters.toSortedList(c); for (T2 inner : keys) { out.println(outer + "\t" + inner + '\t' + c.getCount(inner)); } } out.close(); }
public void addAll(TwoDimensionalCounterInterface<K1, K2> c) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.addInPlace(myInner, inner); total += inner.totalCount(); } }
public void subtractAll(TwoDimensionalCounterInterface<K1, K2> c, boolean removeKeys) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.subtractInPlace(myInner, inner); if (removeKeys) Counters.retainNonZeros(myInner); total -= inner.totalCount(); } }
public static <T1, T2> void save2DCounterSorted(TwoDimensionalCounterInterface<T1, T2> tdc, String filename) throws IOException { PrintWriter out = new PrintWriter(new FileWriter(filename)); for (T1 outer : tdc.firstKeySet()) { Counter<T2> c = tdc.getCounter(outer); List<T2> keys = Counters.toSortedList(c); for (T2 inner : keys) { out.println(outer + "\t" + inner + '\t' + c.getCount(inner)); } } out.close(); }
public static <T1, T2> void save2DCounterSorted(TwoDimensionalCounterInterface<T1, T2> tdc, String filename) throws IOException { PrintWriter out = new PrintWriter(new FileWriter(filename)); for (T1 outer : tdc.firstKeySet()) { Counter<T2> c = tdc.getCounter(outer); List<T2> keys = Counters.toSortedList(c); for (T2 inner : keys) { out.println(outer + "\t" + inner + '\t' + c.getCount(inner)); } } out.close(); }
public static <T1, T2> void save2DCounterSorted(TwoDimensionalCounterInterface<T1, T2> tdc, String filename) throws IOException { PrintWriter out = new PrintWriter(new FileWriter(filename)); for (T1 outer : tdc.firstKeySet()) { Counter<T2> c = tdc.getCounter(outer); List<T2> keys = Counters.toSortedList(c); for (T2 inner : keys) { out.println(outer + "\t" + inner + '\t' + c.getCount(inner)); } } out.close(); }
public void addAll(TwoDimensionalCounterInterface<K1, K2> c) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.addInPlace(myInner, inner); total += inner.totalCount(); } }
public void addAll(TwoDimensionalCounterInterface<K1, K2> c) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.addInPlace(myInner, inner); total += inner.totalCount(); } }
public void addAll(TwoDimensionalCounterInterface<K1, K2> c) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.addInPlace(myInner, inner); total += inner.totalCount(); } }
public void subtractAll(TwoDimensionalCounterInterface<K1, K2> c, boolean removeKeys) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.subtractInPlace(myInner, inner); if (removeKeys) Counters.retainNonZeros(myInner); total -= inner.totalCount(); } }
public void subtractAll(TwoDimensionalCounterInterface<K1, K2> c, boolean removeKeys) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.subtractInPlace(myInner, inner); if (removeKeys) Counters.retainNonZeros(myInner); total -= inner.totalCount(); } }
public void subtractAll(TwoDimensionalCounterInterface<K1, K2> c, boolean removeKeys) { for (K1 key : c.firstKeySet()) { Counter<K2> inner = c.getCounter(key); ClassicCounter<K2> myInner = getCounter(key); Counters.subtractInPlace(myInner, inner); if (removeKeys) Counters.retainNonZeros(myInner); total -= inner.totalCount(); } }