K - public class DoubleHashMap<K>
extends java.util.AbstractSet<K>
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object[] |
keys
Holds the keys
|
protected int |
size
Holds size
|
protected double[] |
values
Holds the values
|
| Constructor and Description |
|---|
DoubleHashMap()
Constructor
|
DoubleHashMap(K... keys)
Creates a DoubleHashMap with these keys set to 1
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.util.Collection<K> set)
increases the counters
|
void |
add(DoubleHashMap<K> countBindings)
Adds all integer values up
|
boolean |
add(K e) |
boolean |
add(K key,
double delta)
Increases a value, true for 'added new key with delta as value', false for 'increased existing value'
|
void |
clear() |
double |
computeSum()
Computes the sum
|
boolean |
contains(java.lang.Object o) |
boolean |
containsKey(java.lang.Object key)
True if value is there
|
java.util.List<K> |
decreasingKeys()
returns the keys in decreasing order
|
boolean |
equals(java.lang.Object o) |
protected int |
find(java.lang.Object key)
Finds a key, keys[find] will be NULL if non-existent
|
double |
findMax()
Finds the maximum value
|
double |
get(K key)
Retrieves a value
|
double |
get(K key,
int defaultValue)
Retrieves a value
|
int |
hashCode() |
boolean |
increase(K key)
Increases a value, true for 'added new key with value 1', false for 'increased existing value'
|
java.util.List<K> |
increasingKeys()
returns the keys in increasing order
|
protected int |
index(java.lang.Object key)
Returns an index where to store the object
|
protected int |
index(java.lang.Object key,
int len)
Returns an index where to store the object
|
java.util.Iterator<K> |
iterator() |
PeekIterator<K> |
keys()
Returns keys.
|
static void |
main(java.lang.String[] args)
Test
|
boolean |
put(K key,
double value)
Adds a key, true for 'added the key as new', false for 'overwrote existing value'
|
protected boolean |
put(java.lang.Object[] keys,
double[] values,
java.lang.Object key,
double value)
Adds a key, true for 'added the key as new', false for 'overwrote existing value'
|
protected void |
rehash()
Rehashes
|
int |
size() |
java.lang.String |
toString() |
addAll, containsAll, isEmpty, remove, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitprotected java.lang.Object[] keys
protected double[] values
protected int size
public DoubleHashMap()
public DoubleHashMap(K... keys)
protected int index(java.lang.Object key,
int len)
protected int index(java.lang.Object key)
public double get(K key)
protected int find(java.lang.Object key)
public double get(K key, int defaultValue)
public boolean containsKey(java.lang.Object key)
public boolean add(K key, double delta)
public boolean increase(K key)
public PeekIterator<K> keys()
public boolean put(K key, double value)
protected boolean put(java.lang.Object[] keys,
double[] values,
java.lang.Object key,
double value)
protected void rehash()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Iterator<K> iterator()
public int size()
public boolean add(K e)
public void clear()
public boolean contains(java.lang.Object o)
public void add(DoubleHashMap<K> countBindings)
public void add(java.util.Collection<K> set)
public java.lang.String toString()
toString in class java.util.AbstractCollection<K>public java.util.List<K> increasingKeys()
public java.util.List<K> decreasingKeys()
public boolean equals(java.lang.Object o)
public int hashCode()
public double findMax()
public double computeSum()