| java.lang.Object org.archive.util.AbstractLongFPSet
All known Subclasses: org.archive.util.fingerprint.MemLongFPSet,
AbstractLongFPSet | abstract public class AbstractLongFPSet implements LongFPSet,Serializable(Code) | | Shell of functionality for a Set of primitive long fingerprints, held
in an array of possibly-empty slots.
The implementation of that holding array is delegated to subclasses.
Capacity is always a power of 2.
Fingerprints are already assumed to be well-distributed, so the
hashed position for a value is just its high-order bits.
author: gojomo version: $Date: 2005-05-06 02:49:04 +0000 (Fri, 06 May 2005) $, $Revision: 3437 $ |
Field Summary | |
protected static byte | EMPTY A constant used to indicate that a slot in the set storage is empty. | protected int | capacityPowerOfTwo | protected long | count | protected float | loadFactor The load factor, as a fraction. |
Constructor Summary | |
public | AbstractLongFPSet() | public | AbstractLongFPSet(int capacityPowerOfTwo, float loadFactor) Create a new AbstractLongFPSet with a given capacity and load Factor
Parameters: capacityPowerOfTwo - The capacity as the exponent of a power of 2.e.g if the capacity is 4 this means 2^^4 entries Parameters: loadFactor - The load factor as a fraction. |
Method Summary | |
public boolean | add(long val) | abstract protected void | clearAt(long index) | public boolean | contains(long val) | public long | count() Return the number of entries in this set. | abstract protected long | getAt(long i) Get the stored value at the given slot. | abstract protected int | getSlotState(long i) Check the state of a slot in the storage. | abstract protected void | makeSpace() Make additional space to keep the load under the target
loadFactor level. | public boolean | quickContains(long fp) Low-cost, non-definitive (except when true) contains
test. | abstract protected void | relocate(long value, long fromIndex, long toIndex) | public boolean | remove(long l) | protected void | removeAt(long index) Remove the value at the given index, relocating its
successors as necessary. | abstract protected void | setAt(long i, long l) Set the stored value at the given slot. |
EMPTY | protected static byte EMPTY(Code) | | A constant used to indicate that a slot in the set storage is empty.
A zero or positive value means slot is filled
|
capacityPowerOfTwo | protected int capacityPowerOfTwo(Code) | | the capacity of this set, specified as the exponent of a power of 2
|
count | protected long count(Code) | | The current number of elements in the set
|
loadFactor | protected float loadFactor(Code) | | The load factor, as a fraction. This gives the amount of free space
to keep in the Set.
|
AbstractLongFPSet | public AbstractLongFPSet()(Code) | | To support serialization
TODO: verify needed?
|
AbstractLongFPSet | public AbstractLongFPSet(int capacityPowerOfTwo, float loadFactor)(Code) | | Create a new AbstractLongFPSet with a given capacity and load Factor
Parameters: capacityPowerOfTwo - The capacity as the exponent of a power of 2.e.g if the capacity is 4 this means 2^^4 entries Parameters: loadFactor - The load factor as a fraction. This gives the amountof free space to keep in the Set. |
clearAt | abstract protected void clearAt(long index)(Code) | | |
getAt | abstract protected long getAt(long i)(Code) | | Get the stored value at the given slot.
Parameters: i - the slot index The stored value at the given slot. |
getSlotState | abstract protected int getSlotState(long i)(Code) | | Check the state of a slot in the storage.
Parameters: i - the index of the slot to check -1 if slot is filled; nonegative if full. |
makeSpace | abstract protected void makeSpace()(Code) | | Make additional space to keep the load under the target
loadFactor level.
Subclasses may grow or discard entries to satisfy.
|
relocate | abstract protected void relocate(long value, long fromIndex, long toIndex)(Code) | | |
remove | public boolean remove(long l)(Code) | | |
removeAt | protected void removeAt(long index)(Code) | | Remove the value at the given index, relocating its
successors as necessary.
Parameters: index - |
setAt | abstract protected void setAt(long i, long l)(Code) | | Set the stored value at the given slot.
Parameters: i - the slot index Parameters: l - the value to set |
|
|