com.fxpal.search.reverted.filters
Class BasisQueryWrapper

java.lang.Object
  extended by com.fxpal.search.reverted.filters.BasisQueryWrapper
All Implemented Interfaces:
BasisQuerySource, java.lang.Iterable<BasisQuery>, java.util.Iterator<BasisQuery>
Direct Known Subclasses:
BasisQueryRecorder, Filter

public class BasisQueryWrapper
extends java.lang.Object
implements BasisQuerySource

Base class for composing filters for basis queries. Subclasses will override hasNext() or next() methods.

Subclasses of this class can be composed into chains of filters.

When the instance runs out of terms to iterate over, it will call the close() method. Subclasses should close resources by overriding this method, and calling super.close();.

Author:
Gene Golovchinsky

Constructor Summary
BasisQueryWrapper(BasisQuerySource source)
          Default constructor
 
Method Summary
 void close()
          If the source is a BasisQuerySource, close will be called on the source as well.
 boolean hasNext()
          Returns true if there are more queries to process.
 java.util.Iterator<BasisQuery> iterator()
          Returns this instance.
 BasisQuery next()
          Returns the next available query from the source
 void remove()
          These collections are read-only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasisQueryWrapper

public BasisQueryWrapper(BasisQuerySource source)
Default constructor

Parameters:
source - Source of basis queries that the instance wraps
Method Detail

hasNext

public boolean hasNext()
Returns true if there are more queries to process. Closes the instance if no more data are available.

Specified by:
hasNext in interface java.util.Iterator<BasisQuery>

next

public BasisQuery next()
Returns the next available query from the source

Specified by:
next in interface java.util.Iterator<BasisQuery>

remove

public void remove()
These collections are read-only.

Specified by:
remove in interface java.util.Iterator<BasisQuery>

iterator

public java.util.Iterator<BasisQuery> iterator()
Returns this instance.

Specified by:
iterator in interface java.lang.Iterable<BasisQuery>

close

public void close()
If the source is a BasisQuerySource, close will be called on the source as well. This allows BasisQueryStream instances to co-exist with simple Iterators.

Specified by:
close in interface BasisQuerySource