|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.util.StringIntSizedMap
public class StringIntSizedMap
Fixed size hash map using String values as keys mapped to
primitive int values.
| Field Summary | |
|---|---|
static double |
DEFAULT_FILL_FRACTION
Default fill fraction for sizing of tables. |
static int |
DEFAULT_NOT_FOUND
Default value returned when key not found in table. |
protected int |
m_arraySize
Size of array used for keys. |
protected int |
m_hitOffset
Offset added (modulo table size) to slot number on collision. |
protected String[] |
m_keyTable
Array of key table slots. |
protected int |
m_notFoundValue
Value returned when key not found in table. |
protected int[] |
m_valueTable
Array of value table slots. |
| Constructor Summary | |
|---|---|
StringIntSizedMap(int count)
Constructor with only value count specified. |
|
StringIntSizedMap(int count,
double fill,
int miss)
Constructor with full specification. |
|
StringIntSizedMap(int count,
int miss)
Constructor with value count and miss value specified. |
|
| Method Summary | |
|---|---|
int |
add(String key,
int value)
Add an entry to the table. |
void |
clear()
Set the table to the empty state. |
boolean |
containsKey(String key)
Check if an entry is present in the table. |
int |
get(String key)
Find an entry in the table. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double DEFAULT_FILL_FRACTION
public static final int DEFAULT_NOT_FOUND
protected final int m_arraySize
protected final String[] m_keyTable
protected final int[] m_valueTable
protected final int m_notFoundValue
protected final int m_hitOffset
| Constructor Detail |
|---|
public StringIntSizedMap(int count,
double fill,
int miss)
count - number of values to assume in sizing of tablefill - fraction fill for table (maximum of 0.7, to
prevent excessive collisions)miss - value returned when key not found in table
public StringIntSizedMap(int count,
int miss)
count - number of values to assume in initial sizing of tablemiss - value returned when key not found in tablepublic StringIntSizedMap(int count)
count - number of values to assume in initial sizing of table| Method Detail |
|---|
public int add(String key,
int value)
key - key to be added to table (non-null)value - associated value for key
public final boolean containsKey(String key)
key - key for entry to be found
true if key found in table, false
if notpublic final int get(String key)
key - key for entry to be returned
public void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||