Class Filter
- java.lang.Object
-
- org.apache.accumulo.core.bloomfilter.Filter
-
- All Implemented Interfaces:
org.apache.hadoop.io.Writable
- Direct Known Subclasses:
BloomFilter,DynamicBloomFilter
public abstract class Filter extends Object implements org.apache.hadoop.io.Writable
Defines the general behavior of a filter.A filter is a data structure which aims at offering a lossy summary of a set
A. The key idea is to map entries ofA(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.
- See Also:
The general behavior of a key,A hash function
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.hadoop.util.bloom.HashFunctionhashThe hash function used to map a key to several positions in the vector.protected inthashTypeType of hashing function to use.protected intnbHashThe number of hash function to consider.protected intvectorSizeThe vector size of this filter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanadd(org.apache.hadoop.util.bloom.Key key)Adds a key to this filter.abstract voidand(Filter filter)Performs a logical AND between this filter and a specified filter.protected intgetSerialVersion()protected intgetVersion()abstract booleanmembershipTest(org.apache.hadoop.util.bloom.Key key)Determines whether a specified key belongs to this filter.abstract voidnot()Performs a logical NOT on this filter.abstract voidor(Filter filter)Performs a logical OR between this filter and a specified filter.voidreadFields(DataInput in)voidwrite(DataOutput out)abstract voidxor(Filter filter)Performs a logical XOR between this filter and a specified filter.
-
-
-
Field Detail
-
vectorSize
protected int vectorSize
The vector size of this filter.
-
hash
protected org.apache.hadoop.util.bloom.HashFunction hash
The hash function used to map a key to several positions in the vector.
-
nbHash
protected int nbHash
The number of hash function to consider.
-
hashType
protected int hashType
Type of hashing function to use.
-
-
Method Detail
-
add
public abstract boolean add(org.apache.hadoop.util.bloom.Key key)
Adds a key to this filter.- Parameters:
key- The key to add.- Returns:
- true if the key was added, false otherwise.
-
membershipTest
public abstract boolean membershipTest(org.apache.hadoop.util.bloom.Key key)
Determines whether a specified key belongs to this filter.- Parameters:
key- The key to test.- Returns:
- boolean True if the specified key belongs to this filter. False otherwise.
-
and
public abstract void and(Filter filter)
Performs a logical AND between this filter and a specified filter.Invariant: The result is assigned to this filter.
- Parameters:
filter- The filter to AND with.
-
or
public abstract void or(Filter filter)
Performs a logical OR between this filter and a specified filter.Invariant: The result is assigned to this filter.
- Parameters:
filter- The filter to OR with.
-
xor
public abstract void xor(Filter filter)
Performs a logical XOR between this filter and a specified filter.Invariant: The result is assigned to this filter.
- Parameters:
filter- The filter to XOR with.
-
not
public abstract void not()
Performs a logical NOT on this filter.The result is assigned to this filter.
-
write
public void write(DataOutput out) throws IOException
- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
getSerialVersion
protected int getSerialVersion()
-
getVersion
protected int getVersion()
-
readFields
public void readFields(DataInput in) throws IOException
- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
-