/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2,o3})</code>; works only for depth 3 * GeneralizedCounters */ public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2})</code>; works only for depth 2 * GeneralizedCounters */ public double getCount(K o1, K o2) { if (depth != 2) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2); } }
/** * returns a {@code double[]} array of length * {@code depth+1}, containing the conditional counts on a * {@code depth}-length list given each level of conditional * distribution from 0 to {@code depth}. */ public double[] getCounts(List<K> l) { if (l.size() != depth) { wrongDepth(); //throws exception } double[] counts = new double[depth + 1]; GeneralizedCounter<K> next = this; counts[0] = next.totalCount(); Iterator<K> i = l.iterator(); int j = 1; K o = i.next(); while (i.hasNext()) { next = next.conditionalizeHelper(o); counts[j] = next.totalCount(); o = i.next(); j++; } counts[depth] = next.getCount(o); return counts; }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2,o3})</code>; works only for depth 3 * GeneralizedCounters */ public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2,o3})</code>; works only for depth 3 * GeneralizedCounters */ public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2})</code>; works only for depth 2 * GeneralizedCounters */ public double getCount(K o1, K o2) { if (depth != 2) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2})</code>; works only for depth 2 * GeneralizedCounters */ public double getCount(K o1, K o2) { if (depth != 2) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2})</code>; works only for depth 2 * GeneralizedCounters */ public double getCount(K o1, K o2) { if (depth != 2) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2})</code>; works only for depth 2 * GeneralizedCounters */ public double getCount(K o1, K o2) { if (depth != 2) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2,o3})</code>; works only for depth 3 * GeneralizedCounters */ public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
/** * A convenience method equivalent to <code>{@link * #getCounts}({o1,o2,o3})</code>; works only for depth 3 * GeneralizedCounters */ public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
/** * returns a {@code double[]} array of length * {@code depth+1}, containing the conditional counts on a * {@code depth}-length list given each level of conditional * distribution from 0 to {@code depth}. */ public double[] getCounts(List<K> l) { if (l.size() != depth) { wrongDepth(); //throws exception } double[] counts = new double[depth + 1]; GeneralizedCounter<K> next = this; counts[0] = next.totalCount(); Iterator<K> i = l.iterator(); int j = 1; K o = i.next(); while (i.hasNext()) { next = next.conditionalizeHelper(o); counts[j] = next.totalCount(); o = i.next(); j++; } counts[depth] = next.getCount(o); return counts; }
/** * returns a {@code double[]} array of length * {@code depth+1}, containing the conditional counts on a * {@code depth}-length list given each level of conditional * distribution from 0 to {@code depth}. */ public double[] getCounts(List<K> l) { if (l.size() != depth) { wrongDepth(); //throws exception } double[] counts = new double[depth + 1]; GeneralizedCounter<K> next = this; counts[0] = next.totalCount(); Iterator<K> i = l.iterator(); int j = 1; K o = i.next(); while (i.hasNext()) { next = next.conditionalizeHelper(o); counts[j] = next.totalCount(); o = i.next(); j++; } counts[depth] = next.getCount(o); return counts; }
/** * returns a <code>double[]</code> array of length * <code>depth+1</code>, containing the conditional counts on a * <code>depth</code>-length list given each level of conditional * distribution from 0 to <code>depth</code>. */ public double[] getCounts(List<K> l) { if (l.size() != depth) { wrongDepth(); //throws exception } double[] counts = new double[depth + 1]; GeneralizedCounter<K> next = this; counts[0] = next.totalCount(); Iterator<K> i = l.iterator(); int j = 1; K o = i.next(); while (i.hasNext()) { next = next.conditionalizeHelper(o); counts[j] = next.totalCount(); o = i.next(); j++; } counts[depth] = next.getCount(o); return counts; }
/** * returns a {@code double[]} array of length * {@code depth+1}, containing the conditional counts on a * {@code depth}-length list given each level of conditional * distribution from 0 to {@code depth}. */ public double[] getCounts(List<K> l) { if (l.size() != depth) { wrongDepth(); //throws exception } double[] counts = new double[depth + 1]; GeneralizedCounter<K> next = this; counts[0] = next.totalCount(); Iterator<K> i = l.iterator(); int j = 1; K o = i.next(); while (i.hasNext()) { next = next.conditionalizeHelper(o); counts[j] = next.totalCount(); o = i.next(); j++; } counts[depth] = next.getCount(o); return counts; }