edu.illinois.cs.cogcomp.lbj.coref.util.collections
Class Histogram<T>

java.lang.Object
  extended by edu.illinois.cs.cogcomp.lbj.coref.util.collections.Histogram<T>

public class Histogram<T>
extends java.lang.Object


Field Summary
(package private)  java.util.Map<T,java.lang.Integer> m_map
           
 
Constructor Summary
Histogram()
           
Histogram(java.util.Collection<T> items)
          Creates a new histogram, incrementing by one for each occurance of an item in the Collection.
 
Method Summary
 void addAll(java.util.Map<T,java.lang.Integer> histogram)
          increment each key in histogram by the corresponding value.
 int get(T item)
          Gets the count of item.
 void increment(T item)
          Increment the count for item, setting it to one if never seen before.
 void increment(T item, int by)
           
 java.util.Set<T> keySet()
           
 void set(T item, int to)
          Sets the histogram's value of item to to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_map

java.util.Map<T,java.lang.Integer> m_map
Constructor Detail

Histogram

public Histogram()

Histogram

public Histogram(java.util.Collection<T> items)
Creates a new histogram, incrementing by one for each occurance of an item in the Collection.

Method Detail

addAll

public void addAll(java.util.Map<T,java.lang.Integer> histogram)
increment each key in histogram by the corresponding value.


get

public int get(T item)
Gets the count of item. If item is unseen, returns 0.


set

public void set(T item,
                int to)
Sets the histogram's value of item to to.


increment

public void increment(T item)
Increment the count for item, setting it to one if never seen before.


increment

public void increment(T item,
                      int by)

keySet

public java.util.Set<T> keySet()