net.i2p.util
public class DecayingHashSet extends DecayingBloomFilter
_context, _currentDuplicates, _decayEvent, _durationMs, _entryBytes, _keepDecaying, _log, _name
Constructor and Description |
---|
DecayingHashSet(I2PAppContext context,
int durationMs,
int entryBytes)
Create a double-buffered hash set that will decay its entries over time.
|
DecayingHashSet(I2PAppContext context,
int durationMs,
int entryBytes,
String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(byte[] entry,
int off,
int len) |
boolean |
add(long entry) |
void |
clear() |
double |
getFalsePositiveRate()
pointless, only used for logging elsewhere
|
int |
getInsertedCount()
unsynchronized but only used for logging elsewhere
|
boolean |
isKnown(long entry) |
static void |
main(String[] args)
vs.
|
void |
stopDecaying()
super doesn't call clear, but neither do the users, so it seems like we should here
|
add, getCurrentDuplicateCount
public DecayingHashSet(I2PAppContext context, int durationMs, int entryBytes)
durationMs
- entries last for at least this long, but no more than twice this longentryBytes
- how large are the entries to be added? 1 to 32 bytespublic DecayingHashSet(I2PAppContext context, int durationMs, int entryBytes, String name)
name
- just for logging / debugging / statspublic int getInsertedCount()
getInsertedCount
in class DecayingBloomFilter
public double getFalsePositiveRate()
getFalsePositiveRate
in class DecayingBloomFilter
public boolean add(byte[] entry, int off, int len)
add
in class DecayingBloomFilter
public boolean add(long entry)
add
in class DecayingBloomFilter
public boolean isKnown(long entry)
isKnown
in class DecayingBloomFilter
public void clear()
clear
in class DecayingBloomFilter
public void stopDecaying()
stopDecaying
in class DecayingBloomFilter
public static void main(String[] args)