/** * Returns the set of entries in the GeneralizedCounter. * Here, each key is a read-only {@link * List} of size equal to the depth of the GeneralizedCounter, and * each value is a {@link Double}. Each entry is a {@link java.util.Map.Entry} object, * but these objects * do not support the {@link java.util.Map.Entry#setValue} method; attempts to call * that method with result * in an {@link UnsupportedOperationException} being thrown. */ public Set<Map.Entry<List<K>,Double>> entrySet() { return ErasureUtils.<Set<Map.Entry<List<K>,Double>>>uncheckedCast(entrySet(new HashSet<>(), zeroKey, true)); }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
private void prettyPrint(PrintWriter pw, String buffer, String bufferIncrement) { if (depth == 1) { for (Map.Entry<?, Double> e: entrySet()) { Object key = e.getKey(); double count = e.getValue(); pw.println(buffer + key + "\t" + count); } } else { for (K key: topLevelKeySet()) { GeneralizedCounter<K> gc1 = conditionalize(Arrays.asList(ErasureUtils.<K[]>uncheckedCast(new Object[]{key}))); pw.println(buffer + key + "\t" + gc1.totalCount()); gc1.prettyPrint(pw, buffer + bufferIncrement, bufferIncrement); } } }
conditionalizeHelper(o).entrySet(s, newKey, true);
/** * Returns the set of entries in the GeneralizedCounter. * Here, each key is a read-only {@link * List} of size equal to the depth of the GeneralizedCounter, and * each value is a {@link Double}. Each entry is a {@link java.util.Map.Entry} object, * but these objects * do not support the {@link java.util.Map.Entry#setValue} method; attempts to call * that method with result * in an {@link UnsupportedOperationException} being thrown. */ public Set<Map.Entry<List<K>,Double>> entrySet() { return ErasureUtils.<Set<Map.Entry<List<K>,Double>>>uncheckedCast(entrySet(new HashSet<>(), zeroKey, true)); }
/** * Returns the set of entries in the GeneralizedCounter. * Here, each key is a read-only {@link * List} of size equal to the depth of the GeneralizedCounter, and * each value is a {@link Double}. Each entry is a {@link java.util.Map.Entry} object, * but these objects * do not support the {@link java.util.Map.Entry#setValue} method; attempts to call * that method with result * in an {@link UnsupportedOperationException} being thrown. */ public Set<Map.Entry<List<K>,Double>> entrySet() { return ErasureUtils.<Set<Map.Entry<List<K>,Double>>>uncheckedCast(entrySet(new HashSet<>(), zeroKey, true)); }
/** * Returns the set of entries in the GeneralizedCounter. * Here, each key is a read-only {@link * List} of size equal to the depth of the GeneralizedCounter, and * each value is a {@link Double}. Each entry is a {@link java.util.Map.Entry} object, * but these objects * do not support the {@link java.util.Map.Entry#setValue} method; attempts to call * that method with result * in an {@link UnsupportedOperationException} being thrown. */ public Set<Map.Entry<List<K>,Double>> entrySet() { return ErasureUtils.<Set<Map.Entry<List<K>,Double>>>uncheckedCast(entrySet(new HashSet<Map.Entry<Object,Double>>(), zeroKey, true)); }
/** * Returns the set of entries in the GeneralizedCounter. * Here, each key is a read-only {@link * List} of size equal to the depth of the GeneralizedCounter, and * each value is a {@link Double}. Each entry is a {@link java.util.Map.Entry} object, * but these objects * do not support the {@link java.util.Map.Entry#setValue} method; attempts to call * that method with result * in an {@link UnsupportedOperationException} being thrown. */ public Set<Map.Entry<List<K>,Double>> entrySet() { return ErasureUtils.<Set<Map.Entry<List<K>,Double>>>uncheckedCast(entrySet(new HashSet<Map.Entry<Object,Double>>(), zeroKey, true)); }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<K>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
public GeneralizedCounter<K> reverseKeys() { GeneralizedCounter<K> result = new GeneralizedCounter<K>(); Set<Map.Entry<List<K>,Double>> entries = entrySet(); for (Map.Entry<List<K>,Double> entry: entries) { List<K> list = entry.getKey(); double count = entry.getValue(); Collections.reverse(list); result.incrementCount(list, count); } return result; }
private void prettyPrint(PrintWriter pw, String buffer, String bufferIncrement) { if (depth == 1) { for (Map.Entry<?, Double> e: entrySet()) { Object key = e.getKey(); double count = e.getValue(); pw.println(buffer + key + "\t" + count); } } else { for (K key: topLevelKeySet()) { GeneralizedCounter<K> gc1 = conditionalize(Arrays.asList(ErasureUtils.<K[]>uncheckedCast(new Object[]{key}))); pw.println(buffer + key + "\t" + gc1.totalCount()); gc1.prettyPrint(pw, buffer + bufferIncrement, bufferIncrement); } } }
private void prettyPrint(PrintWriter pw, String buffer, String bufferIncrement) { if (depth == 1) { for (Map.Entry<?, Double> e: entrySet()) { Object key = e.getKey(); double count = e.getValue(); pw.println(buffer + key + "\t" + count); } } else { for (K key: topLevelKeySet()) { GeneralizedCounter<K> gc1 = conditionalize(Arrays.asList(ErasureUtils.<K[]>uncheckedCast(new Object[]{key}))); pw.println(buffer + key + "\t" + gc1.totalCount()); gc1.prettyPrint(pw, buffer + bufferIncrement, bufferIncrement); } } }
private void prettyPrint(PrintWriter pw, String buffer, String bufferIncrement) { if (depth == 1) { for (Map.Entry<?, Double> e: entrySet()) { Object key = e.getKey(); double count = e.getValue(); pw.println(buffer + key + "\t" + count); } } else { for (K key: topLevelKeySet()) { GeneralizedCounter<K> gc1 = conditionalize(Arrays.asList(ErasureUtils.<K[]>uncheckedCast(new Object[]{key}))); pw.println(buffer + key + "\t" + gc1.totalCount()); gc1.prettyPrint(pw, buffer + bufferIncrement, bufferIncrement); } } }
private void prettyPrint(PrintWriter pw, String buffer, String bufferIncrement) { if (depth == 1) { for (Map.Entry<?, Double> e: entrySet()) { Object key = e.getKey(); double count = e.getValue(); pw.println(buffer + key + "\t" + count); } } else { for (K key: topLevelKeySet()) { GeneralizedCounter<K> gc1 = conditionalize(Arrays.asList(ErasureUtils.<K[]>uncheckedCast(new Object[]{key}))); pw.println(buffer + key + "\t" + gc1.totalCount()); gc1.prettyPrint(pw, buffer + bufferIncrement, bufferIncrement); } } }
conditionalizeHelper(o).entrySet(s, newKey, true);
conditionalizeHelper(o).entrySet(s, newKey, true);
conditionalizeHelper(o).entrySet(s, newKey, true);