com.bigdata.btree.filter
Class TupleFilter<E>

java.lang.Object
  extended by cutthecrap.utils.striterators.FilterBase
      extended by com.bigdata.btree.filter.TupleFilter<E>
Type Parameters:
E - The type of the elements visited by the iterator (tuples of some sort).
All Implemented Interfaces:
ITupleFilter<E>, IFilter, IPropertySet, Serializable, Cloneable
Direct Known Subclasses:
ElementFilter, SameVariableConstraintTupleFilter, TupleUpdater

public abstract class TupleFilter<E>
extends FilterBase
implements ITupleFilter<E>

Filter supporting ITupleIterators.

Warning: Unlike Filter, this class correctly uses a second Tuple instance to perform filtering. This is necessary since the Tuple instance for the base ITupleIterator implementations for the AbstractBTree is reused by next() on each call and the TupleFilter uses one-step lookahead. Failure to use a second Tuple instance will result in overwrite of the current Tuple with data from the lookahead Tuple.

Note: You must specify IRangeQuery.KEYS and/or IRangeQuery.VALS in order to filter on the keys and/or values associated with the visited tuples.

Note: YOu must specify IRangeQuery.CURSOR to enabled Iterator.remove() for a local BTree

Version:
$Id: TupleFilter.java 4388 2011-04-11 13:35:47Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Nested Class Summary
static class TupleFilter.TupleFilterator<E>
          Implementation class knows how to avoid side-effects from the reuse of the same Tuple instance by the base ITupleIterator impls.
 
Constructor Summary
TupleFilter()
           
 
Method Summary
 ITupleIterator<E> filterOnce(Iterator src, Object context)
          Wrap the source iterator with this filter.
protected abstract  boolean isValid(ITuple<E> tuple)
           
 
Methods inherited from class cutthecrap.utils.striterators.FilterBase
addFilter, filter, getProperty, getRequiredProperty, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cutthecrap.utils.striterators.IFilter
filter
 
Methods inherited from interface cutthecrap.utils.striterators.IPropertySet
getProperty
 

Constructor Detail

TupleFilter

public TupleFilter()
Method Detail

filterOnce

public ITupleIterator<E> filterOnce(Iterator src,
                                    Object context)
Description copied from class: FilterBase
Wrap the source iterator with this filter.

Specified by:
filterOnce in interface ITupleFilter<E>
Specified by:
filterOnce in class FilterBase
Parameters:
src - The source iterator.
context - The iterator evaluation context.
Returns:
The wrapped iterator.

isValid

protected abstract boolean isValid(ITuple<E> tuple)


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