com.bigdata.btree
Class NOPBloomFilter

java.lang.Object
  extended by com.bigdata.btree.NOPBloomFilter
All Implemented Interfaces:
IBloomFilter

public final class NOPBloomFilter
extends Object
implements IBloomFilter

A bloom filter that never reports false (this means that you must always check the index) and that does not permit anything to be added and, in fact, has no state.

Version:
$Id: NOPBloomFilter.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
static NOPBloomFilter INSTANCE
           
 
Constructor Summary
NOPBloomFilter()
           
 
Method Summary
 boolean add(byte[] key)
          Adds the key to the filter.
 boolean contains(byte[] key)
          Returns true.
 void falsePos()
          Notify the bloom filter that a false positive was observed for a key that for which IBloomFilter.add(byte[]) reported true (the key was in fact not in the index).
 boolean isEnabled()
          Returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final transient NOPBloomFilter INSTANCE
Constructor Detail

NOPBloomFilter

public NOPBloomFilter()
Method Detail

add

public boolean add(byte[] key)
Description copied from interface: IBloomFilter
Adds the key to the filter.

Specified by:
add in interface IBloomFilter
Parameters:
key - The key.
Returns:
true iff the filter state was unchanged by the incorporation of this key into the filter.
Throws:
UnsupportedOperationException - always.

contains

public boolean contains(byte[] key)
Returns true.

Note: The NOP filter returns true because a true return by a bloom filter means that you have to test the data, which is how we achieve NOP semantics. If this method were to return false then it would be claiming that the key was not in the index!!!

Specified by:
contains in interface IBloomFilter
Parameters:
key - The key.
Returns:
true.

isEnabled

public boolean isEnabled()
Returns true.


falsePos

public void falsePos()
Description copied from interface: IBloomFilter
Notify the bloom filter that a false positive was observed for a key that for which IBloomFilter.add(byte[]) reported true (the key was in fact not in the index). This method exists solely for reporting and tracking the actual error rate of the bloom filter.

Specified by:
falsePos in interface IBloomFilter


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.