|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.utils.FastHash
org.apache.cassandra.utils.FastObjectHash<T>
public abstract class FastObjectHash<T>
An open addressed hashing implementation for Object types.
Field Summary | |
---|---|
protected static java.lang.Object |
FREE
|
protected static java.lang.Object |
REMOVED
|
protected java.lang.Object[] |
set_
the set of Objects |
Fields inherited from class org.apache.cassandra.utils.FastHash |
---|
autoCompactionFactor_, autoCompactRemovesRemaining_, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, free_, loadFactor_, maxSize_, size_ |
Constructor Summary | |
---|---|
FastObjectHash()
Creates a new TObjectHash instance with the default
capacity and load factor. |
|
FastObjectHash(int initialCapacity)
Creates a new TObjectHash instance whose capacity is the
next highest prime above initialCapacity + 1 unless that value
is already prime. |
|
FastObjectHash(int initialCapacity,
float loadFactor)
Creates a new TObjectHash instance with a prime value at
or near the specified capacity and load factor. |
Method Summary | |
---|---|
protected int |
capacity()
|
FastObjectHash<T> |
clone()
|
int |
computeHashCode(T o)
This is the default implementation of TObjectHashingStrategy: it delegates hashing to the Object's hashCode method. |
boolean |
contains(java.lang.Object obj)
Searches the set for obj |
boolean |
equals(T o1,
T o2)
This is the default implementation of TObjectHashingStrategy: it delegates equality comparisons to the first parameter's equals() method. |
protected int |
index(java.lang.Object obj)
Locates the index of obj. |
protected int |
insertionIndex(T obj)
Locates the index at which obj can be inserted. |
protected void |
removeAt(int index)
Delete the record at index. |
protected int |
setUp(int initialCapacity)
initializes the Object set of this hash table. |
protected void |
throwObjectContractViolation(java.lang.Object o1,
java.lang.Object o2)
Convenience methods for subclasses to use in throwing exceptions about badly behaved user objects employed as keys. |
Methods inherited from class org.apache.cassandra.utils.FastHash |
---|
calculateGrownCapacity, clear, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, rehash, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient java.lang.Object[] set_
protected static final java.lang.Object REMOVED
protected static final java.lang.Object FREE
Constructor Detail |
---|
public FastObjectHash()
TObjectHash
instance with the default
capacity and load factor.
public FastObjectHash(int initialCapacity)
TObjectHash
instance whose capacity is the
next highest prime above initialCapacity + 1 unless that value
is already prime.
initialCapacity
- an int
valuepublic FastObjectHash(int initialCapacity, float loadFactor)
TObjectHash
instance with a prime value at
or near the specified capacity and load factor.
initialCapacity
- used to find a prime capacity for the table.loadFactor
- used to calculate the threshold over which rehashing takes
place.Method Detail |
---|
public FastObjectHash<T> clone()
clone
in class FastHash
protected int capacity()
capacity
in class FastHash
protected void removeAt(int index)
FastHash
removeAt
in class FastHash
index
- an int
valueprotected int setUp(int initialCapacity)
setUp
in class FastHash
initialCapacity
- an int
value
int
valuepublic boolean contains(java.lang.Object obj)
obj
- an Object
value
boolean
valueprotected int index(java.lang.Object obj)
obj
- an Object
value
protected int insertionIndex(T obj)
obj
- an Object
value
public final int computeHashCode(T o)
o
- for which the hashcode is to be computed
Object.hashCode()
public final boolean equals(T o1, T o2)
o1
- an Object
valueo2
- an Object
value
Object.equals(Object)
protected final void throwObjectContractViolation(java.lang.Object o1, java.lang.Object o2) throws java.lang.IllegalArgumentException
o1
- the first of the equal elements with unequal hash codes.o2
- the second of the equal elements with unequal hash codes.
java.lang.IllegalArgumentException
- the whole point of this method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |