|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,Object>
danbikel.util.AbstractMapToPrimitive<K>
danbikel.util.HashMapPrimitive<K>
danbikel.util.HashMapDouble<K>
danbikel.parser.CountsTableImpl<K>
public class CountsTableImpl<K>
Provides a mapping between objects and floating-point (double) counts that may be incremented or decremented.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class danbikel.util.HashMapDouble |
---|
HashMapDouble.Entry<K> |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface danbikel.util.MapToPrimitive |
---|
MapToPrimitive.Entry<K> |
Field Summary |
---|
Fields inherited from class danbikel.util.HashMapPrimitive |
---|
defaultInitialCapacity, defaultLoadFactor, hashCodeBitmask, maxCapacity |
Constructor Summary | |
---|---|
CountsTableImpl()
Constructs an empty CountsTable . |
|
CountsTableImpl(int initialCapacity)
Constructs an empty CountsTable with the specified initial
number of hash buckets. |
|
CountsTableImpl(int initialCapacity,
float loadFactor)
Constructs an empty CountsTable with the specified initial
number of hash buckets and the specified load factor. |
Method Summary | |
---|---|
void |
add(K key)
Adds the specified key with a count of 1.0 . |
void |
addAll(CountsTable<K> other)
Adds all the counts from the specified table to this table, adding any new keys in the specified map to this map, if necessary. |
double |
count(K key)
Returns the count of the specified key, or 0 if this
counts table does not contain a count for the specified key. |
double |
count(K key,
int hashCode)
Returns the count of the specified key with the specified hash code, or 0 if this counts table does not contain a count for the
specified key. |
void |
output(String eventName,
Writer writer)
Outputs all the mappings of this map in as S-expressions of the form (name key value) |
void |
putAll(CountsTable<K> other)
Puts the specified map of key objects to their counts into this counts table. |
void |
removeItemsBelow(double threshold)
Removes items in this table whose counts are less than the specified threshold. |
Methods inherited from class danbikel.util.HashMapDouble |
---|
getNewEntry |
Methods inherited from class danbikel.util.HashMapPrimitive |
---|
add, add, add, add, add, add, addEntryMRU, containsKey, entrySet, get, getCapacity, getEntry, getEntry, getEntryMRU, getEntryMRU, getLoadFactor, getOrCreateEntry, getStats, put, put, put, put, put, put, put, put, remove, removeLRU, removeLRU, removeRandom |
Methods inherited from class danbikel.util.AbstractMapToPrimitive |
---|
add, add, add, add, add, add, put, put, put, put, put, put, put, removeRandom, toString |
Methods inherited from class java.util.AbstractMap |
---|
clear, clone, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, size, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface danbikel.util.MapToPrimitive |
---|
add, add, add, add, add, add, add, add, add, add, add, add, getEntry, getEntry, getEntryMRU, getEntryMRU, put, put, put, put, put, put, put, put, put, put, put, put, put, put, removeRandom, removeRandom |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Constructor Detail |
---|
public CountsTableImpl()
CountsTable
.
public CountsTableImpl(int initialCapacity)
CountsTable
with the specified initial
number of hash buckets.
initialCapacity
- the number of hash buckets that this object
will initially havepublic CountsTableImpl(int initialCapacity, float loadFactor)
CountsTable
with the specified initial
number of hash buckets and the specified load factor. If the load factor,
which is average number of items per bucket, is exceeded at runtime, the
number of buckets is roughly doubled and the entire map is re-hashed, as
implemented by the parent class, HashMap
.
initialCapacity
- the number of hash buckets that this object will
initially haveloadFactor
- the load factor of this HashMap
objectMethod Detail |
---|
public void addAll(CountsTable<K> other)
CountsTable
addAll
in interface CountsTable<K>
other
- the other counts table whose counts are to be added
to this tablepublic void putAll(CountsTable<K> other)
CountsTable
putAll
in interface CountsTable<K>
other
- another counts table whose counts are to be put into
this tablepublic void add(K key)
CountsTable
1.0
.
add
in interface CountsTable<K>
key
- the key to be added to this counts tablepublic double count(K key)
CountsTable
0
if this
counts table does not contain a count for the specified key.
count
in interface CountsTable<K>
key
- the key whose count is to be gotten
0
if this
counts table does not contain a count for the specified keypublic double count(K key, int hashCode)
CountsTable
0
if this counts table does not contain a count for the
specified key.
count
in interface CountsTable<K>
key
- the key whose count is to be gottenhashCode
- the hash code of the specified key
0
if this counts table does not contain a count for the
specified keypublic void removeItemsBelow(double threshold)
removeItemsBelow
in interface CountsTable<K>
threshold
- the count threshold below which to remove items from
this tablepublic void output(String eventName, Writer writer) throws IOException
(name key value)
output
in interface CountsTable<K>
eventName
- the name of the events contained in this CountsTable
to output as the first symbol in the three-element listwriter
- the writer to which to output the elements of this
counts table as three-element S-expression lists
IOException
- if there is a problem writing to the specified
writer
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |