public int count(T key) { MutableInt value = get(key); if (value == null) return 0; return value.v; } public void add(T key) {
public int count(T key) { MutableInt value = get(key); if (value == null) return 0; return value.v; } public void add(T key) {
public int count(T key) { MutableInt value = get(key); if (value == null) return 0; return value.v; } public void add(T key) {
public int count(T key) { MutableInt value = get(key); if (value == null) return 0; return value.v; } public void add(T key) {
public int count(T key) { MutableInt value = get(key); if (value == null) return 0; return value.v; } public void add(T key) {
/** * Generate a frequency set as the union of two input sets. If an * element is contained in both sets, the value for the output will be * the maximum of the two input values. * * @param a The first set. * @param b The second set. * @return The union of the two sets, with the maximum value chosen * whenever both sets contain the same key. */ protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) { FrequencySet<String> result = combineAndClip(a, b, 1); for (Map.Entry<String, MutableInt> entry : a.entrySet()) { result.get(entry.getKey()).v = entry.getValue().v; } for (Map.Entry<String, MutableInt> entry : b.entrySet()) { MutableInt slot = result.get(entry.getKey()); slot.v = Math.max(slot.v, entry.getValue().v); } return result; }
/** * Generate a frequency set as the union of two input sets. If an * element is contained in both sets, the value for the output will be * the maximum of the two input values. * * @param a The first set. * @param b The second set. * @return The union of the two sets, with the maximum value chosen * whenever both sets contain the same key. */ protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) { FrequencySet<String> result = combineAndClip(a, b, 1); for (Map.Entry<String, MutableInt> entry : a.entrySet()) { result.get(entry.getKey()).v = entry.getValue().v; } for (Map.Entry<String, MutableInt> entry : b.entrySet()) { MutableInt slot = result.get(entry.getKey()); slot.v = Math.max(slot.v, entry.getValue().v); } return result; }
/** * Generate a frequency set as the union of two input sets. If an * element is contained in both sets, the value for the output will be * the maximum of the two input values. * * @param a The first set. * @param b The second set. * @return The union of the two sets, with the maximum value chosen * whenever both sets contain the same key. */ protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) { FrequencySet<String> result = combineAndClip(a, b, 1); for (Map.Entry<String, MutableInt> entry : a.entrySet()) { result.get(entry.getKey()).v = entry.getValue().v; } for (Map.Entry<String, MutableInt> entry : b.entrySet()) { MutableInt slot = result.get(entry.getKey()); slot.v = Math.max(slot.v, entry.getValue().v); } return result; }
/** * Generate a frequency set as the union of two input sets. If an * element is contained in both sets, the value for the output will be * the maximum of the two input values. * * @param a The first set. * @param b The second set. * @return The union of the two sets, with the maximum value chosen * whenever both sets contain the same key. */ protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) { FrequencySet<String> result = combineAndClip(a, b, 1); for (Map.Entry<String, MutableInt> entry : a.entrySet()) { result.get(entry.getKey()).v = entry.getValue().v; } for (Map.Entry<String, MutableInt> entry : b.entrySet()) { MutableInt slot = result.get(entry.getKey()); slot.v = Math.max(slot.v, entry.getValue().v); } return result; }
/** * Generate a frequency set as the union of two input sets. If an * element is contained in both sets, the value for the output will be * the maximum of the two input values. * * @param a The first set. * @param b The second set. * @return The union of the two sets, with the maximum value chosen * whenever both sets contain the same key. */ protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) { FrequencySet<String> result = combineAndClip(a, b, 1); for (Map.Entry<String, MutableInt> entry : a.entrySet()) { result.get(entry.getKey()).v = entry.getValue().v; } for (Map.Entry<String, MutableInt> entry : b.entrySet()) { MutableInt slot = result.get(entry.getKey()); slot.v = Math.max(slot.v, entry.getValue().v); } return result; }
public void add(T key) { MutableInt value = get(key); if (value == null) { value = new MutableInt(1); put(key, value); } else { value.v++; } } }
public void add(T key) { MutableInt value = get(key); if (value == null) { value = new MutableInt(1); put(key, value); } else { value.v++; } } }
public void add(T key) { MutableInt value = get(key); if (value == null) { value = new MutableInt(1); put(key, value); } else { value.v++; } } }
public void add(T key) { MutableInt value = get(key); if (value == null) { value = new MutableInt(1); put(key, value); } else { value.v++; } } }
public void add(T key) { MutableInt value = get(key); if (value == null) { value = new MutableInt(1); put(key, value); } else { value.v++; } } }