Package chemaxon.marvin.plugin
Class PluginMDocSource
java.lang.Object
chemaxon.marvin.io.MDocSource
chemaxon.marvin.plugin.PluginMDocSource
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<Molecule>
- Since:
- Marvin 5.0, 02/22/2007
-
Constructor Summary
-
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.void
limitRecordCount
(int limit) Limits the number of result docs.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
-
PluginMDocSource
Constructor. Sets the enumerator.- Parameters:
iterator
- the document iteratormaxCount
- the number of result docs
-
-
Method Details
-
limitRecordCount
public void limitRecordCount(int limit) Limits the number of result docs.- Parameters:
limit
- the max number of result docs
-
nextDoc
Produces the next document.- Specified by:
nextDoc
in classMDocSource
- Returns:
- the document or null at end of file
- Throws:
IOException
- If I/O error occurred
-
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- Throws:
IOException
- If I/O error occurred
-
isRewindable
public boolean isRewindable()Tests whether rewinding (seeking backwards) is possible.- Specified by:
isRewindable
in classMDocSource
- Returns:
false
- See Also:
-
seekRecord
Description copied from class:MDocSource
Seeks the specified record. Backward seeking (rewinding) in the stream is only possible if the underlying input stream is seekable. Forward seeking is always possible. Seeking terminates before reaching the specified position if the usercancels
the progress dialog.- Specified by:
seekRecord
in classMDocSource
- Parameters:
k
- positionpmon
- progress monitor ornull
- Throws:
EOFException
- if end of file reached while trying to seekIOException
- if read error occurred- See Also:
-
seekVisitedRecord
Description copied from class:MDocSource
Seeks an already visited position in case of rewindable input.- Specified by:
seekVisitedRecord
in classMDocSource
- Parameters:
k
- the record index- Throws:
IOException
- if read error occurred
-
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
-