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
ConstructorDescriptionArrayMDocSource
(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 TypeMethodDescriptionint
Estimates the total number of records.int
Gets the current record number.int
Gets the total number of records.boolean
Tests whether the end of input is already reached.boolean
Tests whether rewinding (seeking backwards) is possible.nextDoc()
Produces the next document.void
seekRecord
(int k, MProgressMonitor pmon) Seeks the specified record.protected void
seekVisitedRecord
(int k) Seeks an already visited position in case of rewindable input.boolean
Skips the next document.Methods inherited from class chemaxon.marvin.io.MDocSource
close, getDocLabel, getMDocumentStream, getMoleculeIterator, getMolStream, iterator, seekForward, seekRecordAtFraction, skipRecords
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
nextDoc
in classMDocSource
- Returns:
- the document or null at end of file
-
skipRecord
public boolean skipRecord()Skips the next document.- Specified by:
skipRecord
in classMDocSource
- Returns:
true
if the end of the next document is found,false
if there is no chance to continue
-
isRewindable
public boolean isRewindable()Tests whether rewinding (seeking backwards) is possible.- Specified by:
isRewindable
in classMDocSource
- Returns:
true
if rewinding is possible,false
otherwise- See Also:
-
seekRecord
Seeks the specified record.- Specified by:
seekRecord
in 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:
seekVisitedRecord
in classMDocSource
- Parameters:
k
- the record index
-
isEndReached
public boolean isEndReached()Tests whether the end of input is already reached.- Specified by:
isEndReached
in classMDocSource
- Returns:
true
if the end was reached,false
otherwise
-
getRecordCount
public int getRecordCount()Gets the current record number.- Specified by:
getRecordCount
in classMDocSource
- Returns:
- the record number
-
getRecordCountMax
public int getRecordCountMax()Gets the total number of records.- Specified by:
getRecordCountMax
in classMDocSource
- Returns:
- the number of records
-
estimateNumRecords
public int estimateNumRecords()Estimates the total number of records.- Specified by:
estimateNumRecords
in classMDocSource
- Returns:
- estimated number of records or -1 (at the beginning)
-