Class FilteringVariantContextIterator
java.lang.Object
htsjdk.variant.variantcontext.filter.FilteringVariantContextIterator
- All Implemented Interfaces:
CloseableIterator<VariantContext>,Closeable,AutoCloseable,Iterable<VariantContext>,Iterator<VariantContext>
- Direct Known Subclasses:
FilteringIterator
public class FilteringVariantContextIterator
extends Object
implements CloseableIterator<VariantContext>, Iterable<VariantContext>
A filtering iterator for VariantContexts that takes a base iterator and a VariantContextFilter.
The iterator returns all the variantcontexts for which the filter's function "test" returns true (and only those)
-
Constructor Summary
ConstructorsConstructorDescriptionFilteringVariantContextIterator(Iterator<VariantContext> iterator, VariantContextFilter filter) Constructor of an iterator based on the provided iterator and predicate. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Should be implemented to close/release any underlying resources.booleanhasNext()Returns true if the iteration has more elements.iterator()function to satisfy the Iterable interfacenext()Returns the next element in the iteration.voidremove()Required method for Iterator API.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface htsjdk.samtools.util.CloseableIterator
stream, toListMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FilteringVariantContextIterator
public FilteringVariantContextIterator(Iterator<VariantContext> iterator, VariantContextFilter filter) Constructor of an iterator based on the provided iterator and predicate. The resulting records will be all those VariantContexts from iterator for which filter.test( . ) is true- Parameters:
iterator- the backing iteratorfilter- the filter
-
-
Method Details
-
close
public void close()Description copied from interface:CloseableIteratorShould be implemented to close/release any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<VariantContext>
-
hasNext
public boolean hasNext()Returns true if the iteration has more elements.- Specified by:
hasNextin interfaceIterator<VariantContext>- Returns:
- true if the iteration has more elements. Otherwise returns false.
-
next
Returns the next element in the iteration.- Specified by:
nextin interfaceIterator<VariantContext>- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException- if there are no more elements to return
-
remove
public void remove()Required method for Iterator API.- Specified by:
removein interfaceIterator<VariantContext>- Throws:
UnsupportedOperationException- since it is unsupported here.
-
iterator
function to satisfy the Iterable interface- Specified by:
iteratorin interfaceIterable<VariantContext>- Returns:
- itself since the class inherits from Iterator
-