/** * This method returns probability of given element * * @param element * @return */ public double getProbability(T element) { if (totalCount() <= 0.0) throw new IllegalStateException("Can't calculate probability with empty counter"); return getCount(element) / totalCount(); }
/** * This method returns probability of given element * * @param element * @return */ public double getProbability(T element) { if (totalCount() <= 0.0) throw new IllegalStateException("Can't calculate probability with empty counter"); return getCount(element) / totalCount(); }
if (counter.totalCount() <= 0.0) { log.warn("Unable to calculate probability; nothing found"); return; final double totalCount = counter.totalCount();