T
- public class CountMap<T> extends Object implements Iterable<Map.Entry<T,Double>>
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multiset.html
Constructor and Description |
---|
CountMap() |
CountMap(Collection<? extends T> values) |
CountMap(CountMap<? extends T> other)
Initialize the countmap with the content of another count map.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Collection<T> list)
Adds all elements of this collection with a value of 1
|
void |
add(Collection<T> list,
double value)
Adds all elements of this collection with the given value
|
void |
add(CountMap<T> other)
Adds a complete keymap to this key map.
|
Double |
add(T t)
adds T to the map and returns the number of occurences that are now logged
|
Double |
add(T t,
double inc)
increase the counter of the map by 'inc'.
|
void |
clear()
clears the map
|
Set<Map.Entry<T,Double>> |
entrySet() |
Double |
get(T label)
Returns the current value for the given label.
|
double |
getSum()
returns the sum of all values - NOT the size of the map!
|
Iterator<Map.Entry<T,Double>> |
iterator() |
Set<T> |
keySet() |
double |
remove(T t)
Removes the entry from the map and returns the most recent associated value
|
Double |
set(T t,
double value)
Sets a specific value for this label, replacing any (posiibly) existing value
|
int |
size()
returns the amount of entries in the map
|
String |
toString() |
Collection<Double> |
values() |
public CountMap()
public CountMap(Collection<? extends T> values)
public void add(Collection<T> list)
list
- #addAll(java.util.Collection, int)
public void add(Collection<T> list, double value)
list
- value
- public void add(CountMap<T> other)
other
- Keymap whose elements will be addedpublic Double add(T t)
t
- public Double add(T t, double inc)
t
- inc
- public Double set(T t, double value)
t
- value
- public double remove(T t)
t
- public void clear()
public Double get(T label)
label
- public Collection<Double> values()
public double getSum()
public int size()
Copyright © 2012. All Rights Reserved.