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 void
close()
Should be implemented to close/release any underlying resources.boolean
hasNext()
Returns true if the iteration has more elements.Iterator<VariantContext>
iterator()
function to satisfy the Iterable interfaceVariantContext
next()
Returns the next element in the iteration.void
remove()
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:CloseableIterator
Should be implemented to close/release any underlying resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableIterator<VariantContext>
-
hasNext
public boolean hasNext()
Returns true if the iteration has more elements.- Specified by:
hasNext
in 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:
next
in 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:
remove
in interfaceIterator<VariantContext>
- Throws:
UnsupportedOperationException
- since it is unsupported here.
-
iterator
public Iterator<VariantContext> iterator()
function to satisfy the Iterable interface- Specified by:
iterator
in interfaceIterable<VariantContext>
- Returns:
- itself since the class inherits from Iterator
-
-