| java.lang.Object org.jibx.util.StringIntSizedMap
StringIntSizedMap | public class StringIntSizedMap (Code) | | Fixed size hash map using String values as keys mapped to
primitive int values.
author: Dennis M. Sosnoski |
Field Summary | |
final public static double | DEFAULT_FILL_FRACTION Default fill fraction for sizing of tables. | final public static int | DEFAULT_NOT_FOUND Default value returned when key not found in table. | final protected int | m_arraySize Size of array used for keys. | final protected int | m_hitOffset Offset added (modulo table size) to slot number on collision. | final protected String[] | m_keyTable Array of key table slots. | final protected int | m_notFoundValue Value returned when key not found in table. | final protected int[] | m_valueTable Array of value table slots. |
Constructor Summary | |
public | StringIntSizedMap(int count, double fill, int miss) Constructor with full specification. | public | StringIntSizedMap(int count, int miss) Constructor with value count and miss value specified. | public | StringIntSizedMap(int count) Constructor with only value count specified. |
Method Summary | |
public int | add(String key, int value) Add an entry to the table. | public void | clear() Set the table to the empty state. | final public boolean | containsKey(String key) Check if an entry is present in the table. | final public int | get(String key) Find an entry in the table. |
DEFAULT_FILL_FRACTION | final public static double DEFAULT_FILL_FRACTION(Code) | | Default fill fraction for sizing of tables.
|
DEFAULT_NOT_FOUND | final public static int DEFAULT_NOT_FOUND(Code) | | Default value returned when key not found in table.
|
m_arraySize | final protected int m_arraySize(Code) | | Size of array used for keys.
|
m_hitOffset | final protected int m_hitOffset(Code) | | Offset added (modulo table size) to slot number on collision.
|
m_keyTable | final protected String[] m_keyTable(Code) | | Array of key table slots.
|
m_notFoundValue | final protected int m_notFoundValue(Code) | | Value returned when key not found in table.
|
m_valueTable | final protected int[] m_valueTable(Code) | | Array of value table slots.
|
StringIntSizedMap | public StringIntSizedMap(int count, double fill, int miss)(Code) | | Constructor with full specification.
Parameters: count - number of values to assume in sizing of table Parameters: fill - fraction fill for table (maximum of 0.7 , toprevent excessive collisions) Parameters: miss - value returned when key not found in table |
StringIntSizedMap | public StringIntSizedMap(int count, int miss)(Code) | | Constructor with value count and miss value specified. Uses default fill
fraction.
Parameters: count - number of values to assume in initial sizing of table Parameters: miss - value returned when key not found in table |
StringIntSizedMap | public StringIntSizedMap(int count)(Code) | | Constructor with only value count specified. Uses default fill fraction
and miss value.
Parameters: count - number of values to assume in initial sizing of table |
add | public int add(String key, int value)(Code) | | Add an entry to the table. If the key is already present in the table,
this replaces the existing value associated with the key.
Parameters: key - key to be added to table (non-null ) Parameters: value - associated value for key value previously associated with key, or reserved not foundvalue if key not previously present in table |
clear | public void clear()(Code) | | Set the table to the empty state.
|
containsKey | final public boolean containsKey(String key)(Code) | | Check if an entry is present in the table. This method is supplied to
support the use of values matching the reserved not found value.
Parameters: key - key for entry to be found true if key found in table, false if not |
get | final public int get(String key)(Code) | | Find an entry in the table.
Parameters: key - key for entry to be returned value for key, or reserved not found value if key not found |
|
|