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
Constructors Constructor Description FilteringVariantContextIterator(Iterator<VariantContext> iterator, VariantContextFilter filter)Constructor of an iterator based on the provided iterator and predicate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Should be implemented to close/release any underlying resources.booleanhasNext()Returns true if the iteration has more elements.Iterator<VariantContext>iterator()function to satisfy the Iterable interfaceVariantContextnext()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, wait
-
Methods inherited from interface htsjdk.samtools.util.CloseableIterator
stream, toList
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
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 Detail
-
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
public VariantContext next() throws NoSuchElementException
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
public Iterator<VariantContext> iterator()
function to satisfy the Iterable interface- Specified by:
iteratorin interfaceIterable<VariantContext>- Returns:
- itself since the class inherits from Iterator
-
-