Parsing Engine

danbikel.parser
Interface CountsTable

All Superinterfaces:
Map, MapToPrimitive
All Known Implementing Classes:
CountsTableImpl, FileBackedTrainerEventMap

public interface CountsTable
extends MapToPrimitive

Specifies a mapping between objects and floating-point (double) counts that may be incremented or decremented.


Nested Class Summary
 
Nested classes inherited from class danbikel.util.MapToPrimitive
MapToPrimitive.Entry
 
Method Summary
 void add(Object key)
          Adds the specified key with a count of 1.0.
 void addAll(CountsTable 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(Object 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(Object 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 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 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
 

Method Detail

addAll

public void addAll(CountsTable 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.

Parameters:
other - the other counts table whose counts are to be added to this table

putAll

public void putAll(CountsTable other)
Puts the specified map of key objects to their counts into this counts table. If a key from the specified map already exists in this map, it is simply replaced.

Parameters:
other - another counts table whose counts are to be put into this table

add

public void add(Object key)
Adds the specified key with a count of 1.0.

Parameters:
key - the key to be added to this counts table

count

public double count(Object key)
Returns the count of the specified key, or 0 if this counts table does not contain a count for the specified key.

Parameters:
key - the key whose count is to be gotten
Returns:
the count of the specified key, or 0 if this counts table does not contain a count for the specified key

count

public double count(Object 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.

Parameters:
key - the key whose count is to be gotten
hashCode - the hash code of the specified key
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

removeItemsBelow

public void removeItemsBelow(double threshold)
Removes items in this table whose counts are less than the specified threshold.

Parameters:
threshold - the count threshold below which to remove items from this table

output

public void output(String eventName,
                   Writer writer)
            throws IOException
Outputs all the mappings of this map in as S-expressions of the form
(name key value)

Throws:
IOException

Parsing Engine

Author: Dan Bikel.