@PublicAPI public class ConcurrentStandardizerProcessor extends java.lang.Object
Standardizer
object, which is used for performing the standardizations, and a MoleculeIterator
,
for providing input molecules.
This class can be used from command-line or from the API.
See also the Standardizer documentation:
API usage example:
MolExporter exporter = new MolExporter(System.out, "sdf"); MolImporter importer = new MolImporter("mols.sdf"); // create Standardizer with XML configuration file Standardizer standardizer = new Standardizer(new File("config.xml")); // create a ConcurrentStandardizerProcessor ConcurrentStandardizerProcessor csp = new ConcurrentStandardizerProcessor(); // set the standardizer and the molecule iterator for ConcurrentStandardizerProcessor csp.setStandardizer(standardizer); csp.setMoleculeIterator(importer.getMoleculeIterator()); Molecule mol; // standardize the molecules and export the output (standardization is performed in concurrent mode) while ((mol = csp.standardize()) != null) { exporter.write(mol); } importer.close(); exporter.close();
Modifier and Type | Class and Description |
---|---|
static interface |
ConcurrentStandardizerProcessor.MolTransformer
Molecule transformer.
|
Modifier and Type | Field and Description |
---|---|
static ConcurrentStandardizerProcessor.MolTransformer |
TRANSFORMER_SET_DIM_0
Transformer: sets the molecule dimension to 0.
|
Constructor and Description |
---|
ConcurrentStandardizerProcessor() |
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getAppliedTaskIDs()
Returns the IDs of tasks applied to the last input molecule.
|
int[] |
getAppliedTaskIndexes()
Returns the indexes of tasks applied to the last input molecule.
|
Molecule |
getInputMolecule()
Returns the input molecule (the molecule before standardization).
|
double |
getProgress()
Estimates the progress.
|
static void |
main(java.lang.String[] args)
Command line entry point.
|
void |
setMoleculeIterator(MoleculeIterator iterator)
Sets the molecule iterator.
|
void |
setPreprocessor(ConcurrentStandardizerProcessor.MolTransformer tr)
Sets the preprocessor.
|
void |
setStandardizer(Standardizer standardizer)
Sets the standardizer that will be used for performing standardizations.
|
void |
setStoreAppliedTaskData(boolean store)
If set, then applied task data is stored and can be retrieved with methods
getAppliedTaskIDs() , getAppliedTaskIndexes() ,
getInputMolecule() . |
void |
setWorkerThreadCount(int workerThreadCount)
Sets the number of worker threads.
|
Molecule |
standardize()
Performs the standardization of the next input molecule, and returns the standardized molecule.
|
public static final ConcurrentStandardizerProcessor.MolTransformer TRANSFORMER_SET_DIM_0
public void setStandardizer(Standardizer standardizer)
standardizer
- the standardizerpublic void setMoleculeIterator(MoleculeIterator iterator)
iterator
- the molecule iteratorMoleculeIteratorFactory
public void setWorkerThreadCount(int workerThreadCount)
0
: worker thread count = number of available CPU cores
0
)workerThreadCount
- number of worker threadspublic void setPreprocessor(ConcurrentStandardizerProcessor.MolTransformer tr)
tr
- the preprocessorpublic Molecule standardize()
null
if there are no more input moleculesjava.lang.IllegalArgumentException
- if standardizer or molecule iterator is not setjava.lang.RuntimeException
- if an error occurred during standardization and in the case of concurrent
processing errorchemaxon.license.LicenseException
- if there is no valid licensepublic double getProgress()
0
and 1
, or returns -1
.
0
: none of the input molecules are standardized,
1
: all of the input molecules are standardized,
-1
: information about progress can not be provided.public void setStoreAppliedTaskData(boolean store)
getAppliedTaskIDs()
, getAppliedTaskIndexes()
,
getInputMolecule()
. Otherwise the listed methods throw NullPointerException
.store
- if true
then applied task data is storedgetAppliedTaskIndexes()
,
getAppliedTaskIDs()
,
getInputMolecule()
public Molecule getInputMolecule()
java.lang.NullPointerException
- if setStoreAppliedTaskData(boolean)
is not setsetStoreAppliedTaskData(boolean)
public int[] getAppliedTaskIndexes()
java.lang.NullPointerException
- if setStoreAppliedTaskData(boolean)
is not setsetStoreAppliedTaskData(boolean)
public java.lang.String[] getAppliedTaskIDs()
Standardizer.FINAL_CLEAN_ID
corresponds to the final clean action.java.lang.NullPointerException
- if setStoreAppliedTaskData(boolean)
is not setsetStoreAppliedTaskData(boolean)
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- is the command line argument arrayjava.lang.Exception
- on error