Package chemaxon.standardizer.concurrent
Class StandardizerRunner
- java.lang.Object
-
- chemaxon.standardizer.concurrent.StandardizerRunner
-
@PublicAPI public class StandardizerRunner extends Object
Concurrent executor of the standardizer- Since:
- 6.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StandardizerRunner.ErrorHandlingPolicy
Policy for error handling
-
Constructor Summary
Constructors Constructor Description StandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration)
Deprecated.Won't be public in the futureStandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration, int threadCount)
Deprecated.Won't be public in the futureStandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration, int threadCount, String reportPropertyName)
Deprecated.Won't be public in the future
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Molecule
evaluate(StandardizerRunner.ErrorHandlingPolicy policy, StandardizerResult result)
static Iterator<Molecule>
iterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, StandardizerRunner.ErrorHandlingPolicy policy, String reportPropertyName)
Returns an iterator that will wrap the specified iterator and standardizes all molecules.static Iterator<StandardizerResult>
resultIterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, String reportPropertyName)
Returns an iterator that will wrap the specified iterator and standardizes all molecules.static Iterator<StandardizerResult>
resultIterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, String reportPropertyName, boolean saveChangeList)
Returns an iterator that will wrap the specified iterator and standardizes all molecules.static void
standardize(MolImporter importer, MolExporter exporter, StandardizerConfiguration configuration, int threadCount, StandardizerRunner.ErrorHandlingPolicy policy, String reportPropertyName)
Reads the molecules from the importer, standardizes them, and writes to the exporter.
-
-
-
Constructor Detail
-
StandardizerRunner
@Deprecated public StandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration)
Deprecated.Won't be public in the futureConstructs a parallel standardizer runner based on the available processor number.- Parameters:
input
- the input molecule iteratorconfiguration
- the standardizer configuration to apply concurrently
-
StandardizerRunner
@Deprecated public StandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration, int threadCount)
Deprecated.Won't be public in the futureConstructs a parallel standardizer runner that will use specified number of threads for standardization.- Parameters:
input
- the input molecule iteratorconfiguration
- the standardizer configuration to apply concurrentlythreadCount
- the number of standardizer threads
-
StandardizerRunner
@Deprecated public StandardizerRunner(Iterator<Molecule> input, StandardizerConfiguration configuration, int threadCount, String reportPropertyName)
Deprecated.Won't be public in the futureConstructs a parallel standardizer runner that will use specified number of threads for standardization.- Parameters:
input
- the input molecule iteratorconfiguration
- the standardizer configuration to apply concurrentlythreadCount
- the number of standardizer threadsreportPropertyName
- the property name to report the applied actions to
-
-
Method Detail
-
iterator
public static Iterator<Molecule> iterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, StandardizerRunner.ErrorHandlingPolicy policy, String reportPropertyName)
Returns an iterator that will wrap the specified iterator and standardizes all molecules.
IMPORTANT NOTE: in case ofStandardizerRunner.ErrorHandlingPolicy.HALT
the methodIterator.next()
of the resulted molecule iterator may throwIllegalArgumentException
, if exception occurred during standardization. The thrown exception wraps the original exception.
NOTE: the returned iterator not supportsIterator.remove()
.- Parameters:
iterator
- the iterator containing the molecules to be standardizedconfiguration
- the configuration to apply on the iteratorthreadCount
- the number of threads to use for standardizationpolicy
- the error handling policyreportPropertyName
- the name of the property to report applied standardizer actions to- Returns:
- an iterator that iterates through the standardized molecules of the original iterator
-
resultIterator
public static Iterator<StandardizerResult> resultIterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, String reportPropertyName)
Returns an iterator that will wrap the specified iterator and standardizes all molecules. NOTE: the returned iterator not supportsIterator.remove()
.- Parameters:
iterator
- the iterator to wrapconfiguration
- the configuration to apply on the iteratorthreadCount
- the number of threads to use for standardizationreportPropertyName
- the name of the property to report applied standardizer actions to- Returns:
- an iterator that iterates through the standardization results of the original iterator
-
resultIterator
public static Iterator<StandardizerResult> resultIterator(Iterator<Molecule> iterator, StandardizerConfiguration configuration, int threadCount, String reportPropertyName, boolean saveChangeList)
Returns an iterator that will wrap the specified iterator and standardizes all molecules. NOTE: the returned iterator does not supportIterator.remove()
.- Parameters:
iterator
- the iterator to wrapconfiguration
- the configuration to apply on the iteratorthreadCount
- the number of threads to use for standardizationreportPropertyName
- the name of the property to report applied standardizer actions tosaveChangeList
- sets to save the molecule modifications of each performed standardizer action; iftrue
then the changes will be saved- Returns:
- an iterator that iterates through the standardization results of the original iterator
- Since:
- JChem 6.4
-
standardize
public static void standardize(MolImporter importer, MolExporter exporter, StandardizerConfiguration configuration, int threadCount, StandardizerRunner.ErrorHandlingPolicy policy, String reportPropertyName) throws MolExportException, IOException
Reads the molecules from the importer, standardizes them, and writes to the exporter.- Parameters:
importer
- the importer to read molecules fromexporter
- the exporter to write standardized molecules toconfiguration
- the configuration to be applied on the moleculesthreadCount
- the number of threads to use for standardizationpolicy
- the error handling policyreportPropertyName
- the name of the property to report applied standardizer actions to- Throws:
MolExportException
- on export failureIOException
- on export failure
-
evaluate
protected static Molecule evaluate(StandardizerRunner.ErrorHandlingPolicy policy, StandardizerResult result) throws Exception
- Throws:
Exception
-
-