$darkmode
DENOPTIM
denoptim.io.IteratingAtomContainerReader Class Reference

An iterator that take IAtomContainers from a file, possibly using an available iterating reader, or, if such reader does not exist, reads the whole file and collects the containers exposing the iterator over the list of containers. More...

Inheritance diagram for denoptim.io.IteratingAtomContainerReader:
[legend]
Collaboration diagram for denoptim.io.IteratingAtomContainerReader:
[legend]

Public Member Functions

 IteratingAtomContainerReader (File input) throws FileNotFoundException, IOException, CDKException
 Constructs an iterator over the containers that can be found in the given file. More...
 
boolean hasNext ()
 
IAtomContainer next ()
 
void close () throws IOException
 Close the memory-efficient iterator if any is open. More...
 
Class<?> getIteratorType ()
 

Private Attributes

List< IAtomContainer > results
 The containers loaded in memory, or null if we use an Iterator. More...
 
Iterator< IAtomContainer > listIterator
 Reference to the iterator over pre-loaded containers or null if we use the memory-efficient iterator over the file content. More...
 
DefaultIteratingChemObjectReader< IAtomContainer > fileIterator
 Reference to the memory-efficient iterator, or null if we have had to pre-load all containers. More...
 
boolean usingIteratingReader = false
 Flag indicating whether we are using a memory-efficient iterator (true of id we have had to pre-load all containers. More...
 

Detailed Description

An iterator that take IAtomContainers from a file, possibly using an available iterating reader, or, if such reader does not exist, reads the whole file and collects the containers exposing the iterator over the list of containers.

In the latter case, the memory demands are important, so unless a memory-efficient reader is available (see implementations of IteratingSDFReader, this iterator should be used only if the expected size of the input file is small.

Author
Marco Foscato

Definition at line 34 of file IteratingAtomContainerReader.java.

Constructor & Destructor Documentation

◆ IteratingAtomContainerReader()

denoptim.io.IteratingAtomContainerReader.IteratingAtomContainerReader ( File  input) throws FileNotFoundException, IOException, CDKException

Constructs an iterator over the containers that can be found in the given file.

Parameters
inputthe file to read.
Exceptions
FileNotFoundException
IOException
CDKException

Definition at line 70 of file IteratingAtomContainerReader.java.

References denoptim.io.IteratingAtomContainerReader.fileIterator, denoptim.io.IteratingAtomContainerReader.listIterator, denoptim.io.DenoptimIO.readAllAtomContainers(), denoptim.io.IteratingAtomContainerReader.results, and denoptim.io.IteratingAtomContainerReader.usingIteratingReader.

Here is the call graph for this function:

Member Function Documentation

◆ close()

void denoptim.io.IteratingAtomContainerReader.close ( ) throws IOException

Close the memory-efficient iterator if any is open.

Does nothing if we are using the iterator over pre-loaded containers.

Exceptions
IOExceptionif the wrapper cannot be closed.

Definition at line 128 of file IteratingAtomContainerReader.java.

References denoptim.io.IteratingAtomContainerReader.fileIterator.

Referenced by denoptim.fragmenter.FragmenterTools.fragmentation(), and denoptim.fragmenter.ParallelFragmentationAlgorithm.splitInputForThreads().

Here is the caller graph for this function:

◆ getIteratorType()

Class<?> denoptim.io.IteratingAtomContainerReader.getIteratorType ( )
Returns
the class of the iterator defined upon creating a reader

Definition at line 139 of file IteratingAtomContainerReader.java.

References denoptim.io.IteratingAtomContainerReader.fileIterator, denoptim.io.IteratingAtomContainerReader.listIterator, and denoptim.io.IteratingAtomContainerReader.usingIteratingReader.

Referenced by denoptim.gui.GUIGraphHandler.appendGraphsFromConvertingMolecule(), denoptim.fragmenter.ParallelFragmentationAlgorithm.doPreFlightOperations(), and denoptim.ga.EvolutionaryAlgorithm.initializePopulation().

Here is the caller graph for this function:

◆ hasNext()

◆ next()

Member Data Documentation

◆ fileIterator

DefaultIteratingChemObjectReader<IAtomContainer> denoptim.io.IteratingAtomContainerReader.fileIterator
private

◆ listIterator

Iterator<IAtomContainer> denoptim.io.IteratingAtomContainerReader.listIterator
private

Reference to the iterator over pre-loaded containers or null if we use the memory-efficient iterator over the file content.

Definition at line 46 of file IteratingAtomContainerReader.java.

Referenced by denoptim.io.IteratingAtomContainerReader.getIteratorType(), denoptim.io.IteratingAtomContainerReader.hasNext(), denoptim.io.IteratingAtomContainerReader.IteratingAtomContainerReader(), and denoptim.io.IteratingAtomContainerReader.next().

◆ results

List<IAtomContainer> denoptim.io.IteratingAtomContainerReader.results
private

The containers loaded in memory, or null if we use an Iterator.

Definition at line 40 of file IteratingAtomContainerReader.java.

Referenced by denoptim.io.IteratingAtomContainerReader.IteratingAtomContainerReader().

◆ usingIteratingReader

boolean denoptim.io.IteratingAtomContainerReader.usingIteratingReader = false
private

Flag indicating whether we are using a memory-efficient iterator (true of id we have had to pre-load all containers.

Definition at line 58 of file IteratingAtomContainerReader.java.

Referenced by denoptim.io.IteratingAtomContainerReader.getIteratorType(), denoptim.io.IteratingAtomContainerReader.hasNext(), denoptim.io.IteratingAtomContainerReader.IteratingAtomContainerReader(), and denoptim.io.IteratingAtomContainerReader.next().


The documentation for this class was generated from the following file: