org.jibx.util
Class StringSizedSet

java.lang.Object
  extended by org.jibx.util.StringSizedSet

public class StringSizedSet
extends Object

Fixed size hash set of String values.

Author:
Dennis M. Sosnoski

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  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(String key)
          Add a key to the set.
 void clear()
          Set the table to the empty state.
 boolean contains(String key)
          Check if an entry is present in the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILL_FRACTION

public static final double DEFAULT_FILL_FRACTION
Default fill fraction for sizing of tables.

See Also:
Constant Field Values

m_arraySize

protected final int m_arraySize
Size of array used for keys.


m_keyTable

protected final String[] m_keyTable
Array of key table slots.


m_hitOffset

protected final int m_hitOffset
Offset added (modulo table size) to slot number on collision.

Constructor Detail

StringSizedSet

public StringSizedSet(int count,
                      double fill)
Constructor with full specification.

Parameters:
count - number of values to assume in sizing of table
fill - fraction fill for table (maximum of 0.7, to prevent excessive collisions)

StringSizedSet

public StringSizedSet(int count)
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
Method Detail

add

public boolean add(String key)
Add a key to the set. If the key is already present in the set, this does nothing.

Parameters:
key - key to be added to table (non-null)
Returns:
true if added, false if already present value if key not previously present in table

contains

public final boolean contains(String key)
Check if an entry is present in the table.

Parameters:
key - key to be found
Returns:
true if key found in table, false if not

clear

public void clear()
Set the table to the empty state.



Copyright © 2005-2011 jibx.org. All Rights Reserved.