Utils
Class ToDoubleHashMap<K>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,java.lang.Double>
          extended by Utils.ToDoubleHashMap<K>
Type Parameters:
K - The type of the keys
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.lang.Double>

public class ToDoubleHashMap<K>
extends java.util.HashMap<K,java.lang.Double>

A HashMap where the values are doubles. Allows quicker mathematical operations on the values.

Version:
1.0
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
ToDoubleHashMap()
           
 
Method Summary
 void add(K k, double v)
          Add to the the value associated with a key
 K getMaxKey()
          Returns the key which has the maximum value associated with it
 void multiply(K k, double v)
          Multiply the value associated with a key
 
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
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ToDoubleHashMap

public ToDoubleHashMap()
Method Detail

multiply

public void multiply(K k,
                     double v)
Multiply the value associated with a key

Parameters:
k - The key of the value to be changed
v - The amount to multiply the value by

add

public void add(K k,
                double v)
Add to the the value associated with a key

Parameters:
k - The key of the value to be changed
v - The amount to add to the value

getMaxKey

public K getMaxKey()
Returns the key which has the maximum value associated with it

Returns:
The key with the maximum value