public static class MoleculeCallbacks.IndexToNameStoringCallback extends Object implements MoleculeCallback
Note that errors are not stored or reported.
Constructor and Description |
---|
IndexToNameStoringCallback()
Construct.
|
IndexToNameStoringCallback(MoleculeCallback with)
Construct.
|
Modifier and Type | Method and Description |
---|---|
ImmutableList<String> |
getIndexToName()
Get a clone of index to name association.
|
void |
notifyMolecule(int readno,
Optional<String> molString,
Molecule m,
int index)
Introduce new processed molecule.
|
void |
notifyParseError(int readno,
Optional<String> molString,
Throwable t)
Notify a parsing error.
|
void |
notifyProcessingError(int readno,
Optional<String> molString,
Molecule m,
Throwable t)
Notify a processing error.
|
String |
toString() |
void |
toStrings(PrintStream ps,
SubProgressObserver po)
Print index to name associations into escaped strings.
|
public IndexToNameStoringCallback(MoleculeCallback with)
with
- Callback to also invokepublic IndexToNameStoringCallback()
public void notifyMolecule(int readno, Optional<String> molString, Molecule m, int index)
MoleculeCallback
notifyMolecule
in interface MoleculeCallback
readno
- Read molecule count for this event (0 for the first molecule/record in the file). Note that
value does not depend on possible index shift value specified for the import method.molString
- Molecule string from underlying MRecord.getMolString()
if applicablem
- The given structure. If standardization was specified invocation is made after
standardization. In this case the structure represents the standardized structure. In case
the descriptor generation alters the molecule the altered molecule is passed.index
- Internal index which will refer to the given structurepublic void notifyProcessingError(int readno, Optional<String> molString, Molecule m, Throwable t)
MoleculeCallback
This method is invoked when molecule parse was successfull but processing (standardization, descriptor generation, etc. failed
notifyProcessingError
in interface MoleculeCallback
readno
- Read molecule count for this event (0 for the first molecule/record in the file). Note that
value does not depend on possible index shift value specified for the import method.molString
- Molecule string from underlying MRecord.getMolString()
if applicablem
- The given structure when error caught. If standardization was specified and error occured
during standardization then the state of the structure (original or partially/fully
standardized) depends of the internal contracts realized by Standardizer.t
- Processing errorpublic void notifyParseError(int readno, Optional<String> molString, Throwable t)
MoleculeCallback
This method is invoked when molecule parse from String format failed.
notifyParseError
in interface MoleculeCallback
readno
- Read molecule count for this event (0 for the first molecule/record in the file). Note that
value does not depend on possible index shift value specified for the import method.molString
- Molecule string from underlying MRecord.getMolString()
if applicablet
- Parsing errorpublic ImmutableList<String> getIndexToName()
Note that an ImmutableList
is constructed on every invocation which is not cached.
public void toStrings(PrintStream ps, SubProgressObserver po)
Each line will be scaped using StringEscapeUtils.escapeJava(java.lang.String)
.
ps
- Stream to write; will not be closedpo
- Progress Observer to track progress; will be closedCancellationException
- when cancelled