- java.lang.Object
-
- org.ojalgo.netio.SequencedReader<S,T>
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<T>,FromFileReader<T>
final class SequencedReader<S,T> extends java.lang.Object implements FromFileReader<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.netio.FromFileReader
FromFileReader.Builder<F>
-
-
Field Summary
Fields Modifier and Type Field Description private FromFileReader<T>myCurrentprivate java.util.function.Function<S,? extends FromFileReader<T>>myFactoryprivate java.util.concurrent.BlockingQueue<S>mySources
-
Constructor Summary
Constructors Constructor Description SequencedReader(java.util.concurrent.BlockingQueue<S> sources, java.util.function.Function<S,? extends FromFileReader<T>> factory)Create anAutoSupplierthat will supply items from the containers, one after the other, until all containers are empty.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()private voidnextSupplier()Tread()Returning null indicates that there are no more items to read.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ojalgo.netio.FromFileReader
drainTo, forEachInBacthes, iterator, map, stream
-
-
-
-
Field Detail
-
myCurrent
private FromFileReader<T> myCurrent
-
myFactory
private final java.util.function.Function<S,? extends FromFileReader<T>> myFactory
-
mySources
private final java.util.concurrent.BlockingQueue<S> mySources
-
-
Constructor Detail
-
SequencedReader
SequencedReader(java.util.concurrent.BlockingQueue<S> sources, java.util.function.Function<S,? extends FromFileReader<T>> factory)
Create anAutoSupplierthat will supply items from the containers, one after the other, until all containers are empty. You can create multiple such suppliers sharing the same queue of containers.- Type Parameters:
S- The type of some sort of item container (maybe aFile)T- The supplier item type (what do the files contain?)- Parameters:
sources- A set of item containers (could be a set ofFile:s)factory- A factory method that can take one of the "containers" and return an item supplier.
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceFromFileReader<S>- Throws:
java.io.IOException
-
read
public T read()
Description copied from interface:FromFileReaderReturning null indicates that there are no more items to read. That's the same behaviour asBufferedReader.readLine(). All implementations must return null precisely once.- Specified by:
readin interfaceFromFileReader<S>
-
nextSupplier
private void nextSupplier()
-
-