Package chemaxon.marvin.io
Class ArrayMDocSource
java.lang.Object
chemaxon.marvin.io.MDocSource
chemaxon.marvin.io.ArrayMDocSource
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<Molecule>
MDocSource implementation for an array of documents or molecules.- Since:
- Marvin 5.2, 02/27/2009
-
Constructor Summary
ConstructorsConstructorDescriptionArrayMDocSource(MDocument[] docs) Creates a document source for an array of documents.ArrayMDocSource(Molecule[] mols) Creates a document source for an array of molecules.ArrayMDocSource(List<?> list) Creates a document source for a list of documents or molecules. -
Method Summary
Modifier and TypeMethodDescriptionintEstimates the total number of records.intGets the current record number.intGets the total number of records.booleanTests whether the end of input is already reached.booleanTests whether rewinding (seeking backwards) is possible.nextDoc()Produces the next document.voidseekRecord(int k, MProgressMonitor pmon) Seeks the specified record.protected voidseekVisitedRecord(int k) Seeks an already visited position in case of rewindable input.booleanSkips the next document.Methods inherited from class chemaxon.marvin.io.MDocSource
close, getDocLabel, getMDocumentStream, getMoleculeIterator, getMolStream, iterator, seekForward, seekRecordAtFraction, skipRecordsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ArrayMDocSource
Creates a document source for a list of documents or molecules.- Parameters:
list- the list of documents or molecules
-
ArrayMDocSource
Creates a document source for an array of documents.- Parameters:
docs- the array of documents
-
ArrayMDocSource
Creates a document source for an array of molecules.- Parameters:
mols- the array of molecules
-
-
Method Details
-
nextDoc
Produces the next document.- Specified by:
nextDocin classMDocSource- Returns:
- the document or null at end of file
-
skipRecord
public boolean skipRecord()Skips the next document.- Specified by:
skipRecordin classMDocSource- Returns:
trueif the end of the next document is found,falseif there is no chance to continue
-
isRewindable
public boolean isRewindable()Tests whether rewinding (seeking backwards) is possible.- Specified by:
isRewindablein classMDocSource- Returns:
trueif rewinding is possible,falseotherwise- See Also:
-
seekRecord
Seeks the specified record.- Specified by:
seekRecordin classMDocSource- Parameters:
k- positionpmon- progress monitor (unused in this implementation) ornull- See Also:
-
seekVisitedRecord
protected void seekVisitedRecord(int k) Seeks an already visited position in case of rewindable input.- Specified by:
seekVisitedRecordin classMDocSource- Parameters:
k- the record index
-
isEndReached
public boolean isEndReached()Tests whether the end of input is already reached.- Specified by:
isEndReachedin classMDocSource- Returns:
trueif the end was reached,falseotherwise
-
getRecordCount
public int getRecordCount()Gets the current record number.- Specified by:
getRecordCountin classMDocSource- Returns:
- the record number
-
getRecordCountMax
public int getRecordCountMax()Gets the total number of records.- Specified by:
getRecordCountMaxin classMDocSource- Returns:
- the number of records
-
estimateNumRecords
public int estimateNumRecords()Estimates the total number of records.- Specified by:
estimateNumRecordsin classMDocSource- Returns:
- estimated number of records or -1 (at the beginning)
-