/** * This method allows you to set counter value for a given first/second pair * * @param first * @param second * @param value * @return */ public double setCount(F first, S second, double value) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } return counter.setCount(second, value); }
/** * This method will apply normalization to counter values and totals. */ public void normalize() { for (T key : keySet()) { setCount(key, getCount(key) / totalCount.get()); } rebuildTotals(); }
/** * This method allows you to set counter value for a given first/second pair * * @param first * @param second * @param value * @return */ public double setCount(F first, S second, double value) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } return counter.setCount(second, value); }
/** * This method will apply normalization to counter values and totals. */ public void normalize() { for (T key : keySet()) { setCount(key, getCount(key) / totalCount.get()); } rebuildTotals(); }