|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.util.IdBloomFilter
public class IdBloomFilter
Field Summary | |
---|---|
protected byte[] |
array
An internal byte[] for managing ids in a memory-efficent manner The deal with this is that we will be creating a ton of arrays in addId/check. |
protected BloomFilter |
filter
The parameters to the hash functions for this bloom filter |
static int |
NUM_BITS_PER_KEY
The number of bits per key in bloom filters |
static int |
NUM_HASH_FUNCTIONS
The number of different hash functions to use in bloom filters |
Constructor Summary | |
---|---|
IdBloomFilter(IdSet set)
Constructor which takes the number of hash functions to use and the length of the set to use. |
|
IdBloomFilter(InputBuffer buf)
|
Method Summary | |
---|---|
protected void |
addId(Id id)
Method which adds an Id to the underlying bloom filter |
boolean |
check(Id id)
Method which returns whether or not an Id *may* be in the set. |
void |
check(IdSet set,
IdSet result,
int max)
Method which checks an entire IdSet to see if they exist in this bloom filter, and returns the response by adding elements to the other provided id set. |
protected void |
checkArray(Id id)
Internal method for checking to see if the array exists, and if not, instantiating it. |
void |
serialize(OutputBuffer buf)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int NUM_BITS_PER_KEY
public static int NUM_HASH_FUNCTIONS
protected transient byte[] array
protected BloomFilter filter
Constructor Detail |
---|
public IdBloomFilter(IdSet set)
num
- The number of hash functions to uselength
- The length of the underlying bit setpublic IdBloomFilter(InputBuffer buf) throws java.io.IOException
java.io.IOException
Method Detail |
---|
protected void checkArray(Id id)
id
- An id to build the array fromprotected void addId(Id id)
id
- The id to addpublic boolean check(Id id)
id
- The id to check forpublic void check(IdSet set, IdSet result, int max)
set
- THe set to check forresult
- The set to put the non-existing objects intomax
- The maximum number of keys to returnpublic void serialize(OutputBuffer buf) throws java.io.IOException
java.io.IOException
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |