org.apache.accumulo.core.bloomfilter
public abstract class Filter extends Object implements org.apache.hadoop.io.Writable
A filter is a data structure which aims at offering a lossy summary of a set A
. The key idea is to map entries of A
(also called
keys) into several positions in a vector through the use of several hash functions.
Typically, a filter will be implemented as a Bloom filter (or a Bloom filter extension).
It must be extended in order to define the real behavior.
The general behavior of a key
,
A hash function
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.util.bloom.HashFunction |
hash
The hash function used to map a key to several positions in the vector.
|
protected int |
hashType
Type of hashing function to use.
|
protected int |
nbHash
The number of hash function to consider.
|
protected int |
vectorSize
The vector size of this filter.
|
Modifier | Constructor and Description |
---|---|
protected |
Filter() |
protected |
Filter(int vectorSize,
int nbHash,
int hashType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Collection<org.apache.hadoop.util.bloom.Key> keys)
Adds a collection of keys to this filter.
|
abstract boolean |
add(org.apache.hadoop.util.bloom.Key key)
Adds a key to this filter.
|
void |
add(org.apache.hadoop.util.bloom.Key[] keys)
Adds an array of keys to this filter.
|
void |
add(List<org.apache.hadoop.util.bloom.Key> keys)
Adds a list of keys to this filter.
|
abstract void |
and(Filter filter)
Peforms a logical AND between this filter and a specified filter.
|
protected int |
getSerialVersion() |
protected int |
getVersion() |
abstract boolean |
membershipTest(org.apache.hadoop.util.bloom.Key key)
Determines whether a specified key belongs to this filter.
|
abstract void |
not()
Performs a logical NOT on this filter.
|
abstract void |
or(Filter filter)
Peforms a logical OR between this filter and a specified filter.
|
void |
readFields(DataInput in) |
void |
write(DataOutput out) |
abstract void |
xor(Filter filter)
Peforms a logical XOR between this filter and a specified filter.
|
protected int vectorSize
protected org.apache.hadoop.util.bloom.HashFunction hash
protected int nbHash
protected int hashType
protected Filter()
protected Filter(int vectorSize, int nbHash, int hashType)
vectorSize
- The vector size of this filter.nbHash
- The number of hash functions to consider.hashType
- type of the hashing function (see Hash
).public abstract boolean add(org.apache.hadoop.util.bloom.Key key)
key
- The key to add.public abstract boolean membershipTest(org.apache.hadoop.util.bloom.Key key)
key
- The key to test.public abstract void and(Filter filter)
Invariant: The result is assigned to this filter.
filter
- The filter to AND with.public abstract void or(Filter filter)
Invariant: The result is assigned to this filter.
filter
- The filter to OR with.public abstract void xor(Filter filter)
Invariant: The result is assigned to this filter.
filter
- The filter to XOR with.public abstract void not()
The result is assigned to this filter.
public void add(List<org.apache.hadoop.util.bloom.Key> keys)
keys
- The list of keys.public void add(Collection<org.apache.hadoop.util.bloom.Key> keys)
keys
- The collection of keys.public void add(org.apache.hadoop.util.bloom.Key[] keys)
keys
- The array of keys.public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
protected int getSerialVersion()
protected int getVersion()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
Copyright © 2011-2015 The Apache Software Foundation. All Rights Reserved.