|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.util.fingerprint.ArrayLongFPCache
public class ArrayLongFPCache
Simple long fingerprint cache using a backing array; any long maps to one of 'smear' slots. Longs inserted should be randomly distributed,
Field Summary | |
---|---|
(package private) long[] |
cache
|
(package private) int |
count
|
static int |
DEFAULT_CAPACITY
|
static int |
DEFAULT_SMEAR
|
(package private) int |
smear
|
Constructor Summary | |
---|---|
ArrayLongFPCache()
|
Method Summary | |
---|---|
boolean |
add(long l)
Add a fingerprint to the set. |
int |
cacheLength()
|
boolean |
contains(long l)
Does this set contain a given fingerprint. |
long |
count()
get the number of elements in the Set |
boolean |
quickContains(long fp)
Do a contains() check that doesn't require laggy activity (eg disk IO). |
boolean |
remove(long l)
Remove a fingerprint from the set, if it is there |
void |
setCapacity(int newCapacity)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CAPACITY
public static final int DEFAULT_SMEAR
long[] cache
int smear
int count
Constructor Detail |
---|
public ArrayLongFPCache()
Method Detail |
---|
public void setCapacity(int newCapacity)
public boolean add(long l)
LongFPSet
LongFPSet.count()
method returning
1 greater than before the addition.
add
in interface LongFPSet
l
- the fingerprint to add
true
if set has changed with this additionpublic boolean contains(long l)
LongFPSet
contains
in interface LongFPSet
l
- the fingerprint to check for
true
if the fingerprint is in the setpublic boolean remove(long l)
LongFPSet
remove
in interface LongFPSet
l
- the fingerprint to remove
true
if we removed the fingerprintpublic long count()
LongFPSet
count
in interface LongFPSet
public boolean quickContains(long fp)
LongFPSet
quickContains
in interface LongFPSet
fp
- the fingerprint to check for
true
if contains the fingerprintpublic int cacheLength()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |