@Test public void testIncrementAll() { CounterMap<Integer, Integer> counterMapA = new CounterMap<>(); counterMapA.incrementCount(0, 0, 1); counterMapA.incrementCount(0, 1, 1); counterMapA.incrementCount(0, 2, 1); counterMapA.incrementCount(1, 0, 1); counterMapA.incrementCount(1, 1, 1); counterMapA.incrementCount(1, 2, 1); CounterMap<Integer, Integer> counterMapB = new CounterMap<>(); counterMapB.incrementCount(1, 1, 1); counterMapB.incrementCount(2, 1, 1); counterMapA.incrementAll(counterMapB); assertEquals(2.0, counterMapA.getCount(1,1), 1e-5); assertEquals(1.0, counterMapA.getCount(2,1), 1e-5); assertEquals(1.0, counterMapA.getCount(0,0), 1e-5); assertEquals(7, counterMapA.totalSize()); counterMapA.setCount(2, 1, 17); assertEquals(17.0, counterMapA.getCount(2, 1), 1e-5); }
public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } }
CounterMap implements Serializable { public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } } }
CounterMap implements Serializable { public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } } CounterMap(); }
CounterMap implements Serializable { public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } } CounterMap(); boolean isEmpty(); boolean isEmpty(F element); void incrementAll(CounterMap<F, S> other); void incrementCount(F first, S second, double inc); double getCount(F first, S second); double setCount(F first, S second, double value); Pair<F, S> argMax(); void clear(); void clear(F element); Set<F> keySet(); Counter<S> getCounter(F first); Iterator<Pair<F, S>> getIterator(); int size(); int totalSize(); }
CounterMap implements Serializable { public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } } CounterMap(); boolean isEmpty(); boolean isEmpty(F element); void incrementAll(CounterMap<F, S> other); void incrementCount(F first, S second, double inc); double getCount(F first, S second); double setCount(F first, S second, double value); Pair<F, S> argMax(); void clear(); void clear(F element); Set<F> keySet(); Counter<S> getCounter(F first); Iterator<Pair<F, S>> getIterator(); int size(); int totalSize();  }