utils
Class Counter

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.Integer>
          extended by utils.Counter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Integer>

public class Counter
extends java.util.HashMap<java.lang.String,java.lang.Integer>

Class for counting ocurrences of words

Author:
Mateusz Kopec
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
Counter()
           
 
Method Summary
 void addCounter(Counter another)
          Add other counter to this one
 void increase(java.lang.String key)
          Add occurence for word
 void increase(java.lang.String key, int amount)
          Adds number of occurences for word
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Counter

public Counter()
Method Detail

increase

public void increase(java.lang.String key)
Add occurence for word

Parameters:
key - word

increase

public void increase(java.lang.String key,
                     int amount)
Adds number of occurences for word

Parameters:
key - word
amount - how many to add

addCounter

public void addCounter(Counter another)
Add other counter to this one

Parameters:
another - counter