|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.AbstractByteCollection bak.pcj.set.AbstractByteSet bak.pcj.set.ByteChainedHashSet
This class represents chained hash table based sets of byte values. Unlike the Java Collections HashSet instances of this class are not backed up by a map. It is implemented using a simple chained hash table where the keys are stored directly as entries.
ByteOpenHashSet
,
HashSet
,
Serialized FormField Summary | |
static int |
DEFAULT_CAPACITY
The default capacity of this set. |
static int |
DEFAULT_GROWTH_CHUNK
The default chunk size with which to increase the capacity of this set. |
static double |
DEFAULT_GROWTH_FACTOR
The default factor with which to increase the capacity of this set. |
static double |
DEFAULT_LOAD_FACTOR
The default load factor of this set. |
Constructor Summary | |
ByteChainedHashSet()
Creates a new hash set with capacity 11, a relative growth factor of 1.0, and a load factor of 75%. |
|
ByteChainedHashSet(byte[] a)
Creates a new hash set with the same elements as the specified array. |
|
ByteChainedHashSet(ByteCollection c)
Creates a new hash set with the same elements as a specified collection. |
|
ByteChainedHashSet(ByteHashFunction keyhash)
Creates a new hash set with capacity 11, a relative growth factor of 1.0, and a load factor of 75%. |
|
ByteChainedHashSet(ByteHashFunction keyhash,
double loadFactor)
Creates a new hash set with a capacity of 11, a relative growth factor of 1.0, and a specified load factor. |
|
ByteChainedHashSet(ByteHashFunction keyhash,
int capacity)
Creates a new hash set with a specified capacity, a relative growth factor of 1.0, and a load factor of 75%. |
|
ByteChainedHashSet(ByteHashFunction keyhash,
int capacity,
double loadFactor)
Creates a new hash set with a specified capacity and load factor, and a relative growth factor of 1.0. |
|
ByteChainedHashSet(ByteHashFunction keyhash,
int capacity,
double loadFactor,
double growthFactor)
Creates a new hash set with a specified capacity, load factor, and relative growth factor. |
|
ByteChainedHashSet(ByteHashFunction keyhash,
int capacity,
double loadFactor,
int growthChunk)
Creates a new hash set with a specified capacity, load factor, and absolute growth factor. |
|
ByteChainedHashSet(double loadFactor)
Creates a new hash set with a capacity of 11, a relative growth factor of 1.0, and a specified load factor. |
|
ByteChainedHashSet(int capacity)
Creates a new hash set with a specified capacity, a relative growth factor of 1.0, and a load factor of 75%. |
|
ByteChainedHashSet(int capacity,
double loadFactor)
Creates a new hash set with a specified capacity and load factor, and a relative growth factor of 1.0. |
|
ByteChainedHashSet(int capacity,
double loadFactor,
double growthFactor)
Creates a new hash set with a specified capacity, load factor, and relative growth factor. |
|
ByteChainedHashSet(int capacity,
double loadFactor,
int growthChunk)
Creates a new hash set with a specified capacity, load factor, and absolute growth factor. |
Method Summary | |
boolean |
add(byte v)
Adds an element to this collection. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this hash set. |
boolean |
contains(byte v)
Indicates whether this collection contains a specified element. |
int |
hashCode()
Returns a hash code value for this collection. |
ByteIterator |
iterator()
Returns an iterator over this collection. |
boolean |
remove(byte v)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
byte[] |
toArray(byte[] a)
Returns the elements of this collection as an array. |
void |
trimToSize()
Minimizes the memory used by this collection. |
Methods inherited from class bak.pcj.set.AbstractByteSet |
equals |
Methods inherited from class bak.pcj.AbstractByteCollection |
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.ByteCollection |
addAll, containsAll, equals, isEmpty, removeAll, retainAll, toArray |
Field Detail |
public static final double DEFAULT_GROWTH_FACTOR
public static final int DEFAULT_GROWTH_CHUNK
public static final int DEFAULT_CAPACITY
public static final double DEFAULT_LOAD_FACTOR
Constructor Detail |
public ByteChainedHashSet()
public ByteChainedHashSet(ByteCollection c)
c
- the collection whose elements to add to the new
set.
NullPointerException
- if c is null.public ByteChainedHashSet(byte[] a)
a
- the array whose elements to add to the new
set.
NullPointerException
- if a is null.public ByteChainedHashSet(int capacity)
capacity
- the initial capacity of the set.
IllegalArgumentException
- if capacity is negative.public ByteChainedHashSet(double loadFactor)
loadFactor
- the load factor of the set.
IllegalArgumentException
- if loadFactor is negative.public ByteChainedHashSet(int capacity, double loadFactor)
capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive.public ByteChainedHashSet(int capacity, double loadFactor, double growthFactor)
The set capacity increases to capacity()*(1+growthFactor). This strategy is good for avoiding many capacity increases, but the amount of wasted memory is approximately the size of the set.
capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.growthFactor
- the relative amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive;
if growthFactor is not positive.public ByteChainedHashSet(int capacity, double loadFactor, int growthChunk)
The set capacity increases to capacity()+growthChunk. This strategy is good for avoiding wasting memory. However, an overhead is potentially introduced by frequent capacity increases.
capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.growthChunk
- the absolute amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive;
if growthChunk is not positive.public ByteChainedHashSet(ByteHashFunction keyhash)
keyhash
- the hash function to use when hashing keys.
NullPointerException
- if keyhash is null.public ByteChainedHashSet(ByteHashFunction keyhash, int capacity)
keyhash
- the hash function to use when hashing keys.capacity
- the initial capacity of the set.
IllegalArgumentException
- if capacity is negative.
NullPointerException
- if keyhash is null.public ByteChainedHashSet(ByteHashFunction keyhash, double loadFactor)
keyhash
- the hash function to use when hashing keys.loadFactor
- the load factor of the set.
IllegalArgumentException
- if loadFactor is negative.
NullPointerException
- if keyhash is null.public ByteChainedHashSet(ByteHashFunction keyhash, int capacity, double loadFactor)
keyhash
- the hash function to use when hashing keys.capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive.
NullPointerException
- if keyhash is null.public ByteChainedHashSet(ByteHashFunction keyhash, int capacity, double loadFactor, double growthFactor)
The set capacity increases to capacity()*(1+growthFactor). This strategy is good for avoiding many capacity increases, but the amount of wasted memory is approximately the size of the set.
keyhash
- the hash function to use when hashing keys.capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.growthFactor
- the relative amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive;
if growthFactor is not positive.
NullPointerException
- if keyhash is null.public ByteChainedHashSet(ByteHashFunction keyhash, int capacity, double loadFactor, int growthChunk)
The set capacity increases to capacity()+growthChunk. This strategy is good for avoiding wasting memory. However, an overhead is potentially introduced by frequent capacity increases.
keyhash
- the hash function to use when hashing keys.capacity
- the initial capacity of the set.loadFactor
- the load factor of the set.growthChunk
- the absolute amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if loadFactor is not positive;
if growthChunk is not positive.
NullPointerException
- if keyhash is null.Method Detail |
public boolean add(byte v)
ByteCollection
add
in interface ByteCollection
add
in class AbstractByteCollection
public ByteIterator iterator()
ByteCollection
iterator
in interface ByteCollection
public void trimToSize()
ByteCollection
trimToSize
in interface ByteCollection
trimToSize
in class AbstractByteCollection
public Object clone()
public int size()
ByteCollection
size
in interface ByteCollection
size
in class AbstractByteCollection
public void clear()
ByteCollection
clear
in interface ByteCollection
clear
in class AbstractByteCollection
public boolean contains(byte v)
ByteCollection
contains
in interface ByteCollection
contains
in class AbstractByteCollection
public int hashCode()
ByteCollection
hashCode
in interface ByteCollection
hashCode
in class AbstractByteSet
public boolean remove(byte v)
ByteCollection
remove
in interface ByteCollection
remove
in class AbstractByteCollection
public byte[] toArray(byte[] a)
ByteCollection
toArray
in interface ByteCollection
toArray
in class AbstractByteCollection
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |