|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.util.StringSizedSet
public class StringSizedSet
Fixed size hash set of String
values.
Field Summary | |
---|---|
static double |
DEFAULT_FILL_FRACTION
Default fill fraction for sizing of tables. |
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 java.lang.String[] |
m_keyTable
Array of key table slots. |
Constructor Summary | |
---|---|
StringSizedSet(int count)
Constructor with only value count specified. |
|
StringSizedSet(int count,
double fill)
Constructor with full specification. |
Method Summary | |
---|---|
boolean |
add(java.lang.String key)
Add a key to the set. |
void |
clear()
Set the table to the empty state. |
boolean |
contains(java.lang.String key)
Check if an entry is present in the table. |
private int |
freeSlot(int slot)
Find free slot number for entry. |
private int |
standardFind(java.lang.String key)
Standard find key in table. |
private int |
standardSlot(java.lang.String key)
Standard base slot computation for a key. |
private int |
stepSlot(int slot)
Step the slot number for an entry. |
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
protected final int m_arraySize
protected final java.lang.String[] m_keyTable
protected final int m_hitOffset
Constructor Detail |
---|
public StringSizedSet(int count, double fill)
count
- number of values to assume in sizing of tablefill
- fraction fill for table (maximum of 0.7
, to
prevent excessive collisions)public StringSizedSet(int count)
count
- number of values to assume in initial sizing of tableMethod Detail |
---|
private final int stepSlot(int slot)
slot
- slot number to be stepped
private final int freeSlot(int slot)
slot
- initial slot computed from key
private final int standardSlot(java.lang.String key)
hashCode()
method
defined for the key objects or the System.identityHashCode()
method, as selected by the hash technique constructor parameter. To
implement a hash class based on some other methods of hashing and/or
equality testing, define a separate method in the subclass with a
different name and use that method instead. This avoids the overhead
caused by overrides of a very heavily used method.
key
- key value to be computed
private int standardFind(java.lang.String key)
equals
comparisons for
the key values.
key
- to be found in table
-index-1
of slot to be
used for inserting key in table if not already present (always negative)public boolean add(java.lang.String key)
key
- key to be added to table (non-null
)
true
if added, false
if already present
value if key not previously present in tablepublic final boolean contains(java.lang.String key)
key
- key to be found
true
if key found in table, false
if notpublic void clear()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |