public abstract class AbstractLongFPSet extends Object implements LongFPSet, Serializable
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.
Modifier and Type | Field and Description |
---|---|
protected int |
capacityPowerOfTwo
the capacity of this set, specified as the exponent of a power of 2
|
protected long |
count
The current number of elements in the set
|
protected static byte |
EMPTY
A constant used to indicate that a slot in the set storage is empty.
|
protected float |
loadFactor
The load factor, as a fraction.
|
Constructor and Description |
---|
AbstractLongFPSet()
To support serialization
TODO: verify needed?
|
AbstractLongFPSet(int capacityPowerOfTwo,
float loadFactor)
Create a new AbstractLongFPSet with a given capacity and load Factor
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(long val)
Add the given value to this set
|
protected abstract void |
clearAt(long index) |
boolean |
contains(long val)
Does this set contain the given value?
|
long |
count()
Return the number of entries in this set.
|
protected abstract long |
getAt(long i)
Get the stored value at the given slot.
|
protected abstract int |
getSlotState(long i)
Check the state of a slot in the storage.
|
protected abstract void |
makeSpace()
Make additional space to keep the load under the target
loadFactor level.
|
boolean |
quickContains(long fp)
Low-cost, non-definitive (except when true) contains
test.
|
protected abstract void |
relocate(long value,
long fromIndex,
long toIndex) |
boolean |
remove(long l)
Remove a fingerprint from the set, if it is there
|
protected void |
removeAt(long index)
Remove the value at the given index, relocating its
successors as necessary.
|
protected abstract void |
setAt(long i,
long l)
Set the stored value at the given slot.
|
protected static byte EMPTY
protected int capacityPowerOfTwo
protected float loadFactor
protected long count
public AbstractLongFPSet()
public AbstractLongFPSet(int capacityPowerOfTwo, float loadFactor)
capacityPowerOfTwo
- The capacity as the exponent of a power of 2.
e.g if the capacity is 4
this means 2^^4
entriesloadFactor
- The load factor as a fraction. This gives the amount
of free space to keep in the Set.public boolean contains(long val)
contains
in interface LongFPSet
val
- the fingerprint to check fortrue
if the fingerprint is in the setLongFPSet.contains(long)
protected abstract int getSlotState(long i)
i
- the index of the slot to checkpublic long count()
count
in interface LongFPSet
LongFPSet.count()
public boolean add(long val)
add
in interface LongFPSet
val
- the fingerprint to addtrue
if set has changed with this additionLongFPSet.add(long)
protected abstract void makeSpace()
protected abstract void setAt(long i, long l)
i
- the slot indexl
- the value to setprotected abstract long getAt(long i)
i
- the slot indexpublic boolean remove(long l)
LongFPSet
protected void removeAt(long index)
index
- protected abstract void clearAt(long index)
protected abstract void relocate(long value, long fromIndex, long toIndex)
public boolean quickContains(long fp)
quickContains
in interface LongFPSet
fp
- the fingerprint to check fortrue
if contains the fingerprintLongFPSet.quickContains(long)
Copyright © 2003-2014 Internet Archive. All Rights Reserved.