@PublicAPI public class IUPACNamingPlugin extends CalculatorPlugin
API usage example:
// read input molecule MolImporter mi = new MolImporter("test.mol"); Molecule mol = mi.read(); mi.close(); // create plugin IUPACNamingPlugin plugin = new IUPACNamingPlugin(); // set the input molecule plugin.setMolecule(mol); // run the calculation plugin.run(); // get results String preferredIUPACName = plugin.getPreferredIUPACName(); String traditionalName = plugin.getTraditionalName(); String casNumber = plugin.getCASNumber(); // do something with the result ...
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
Molecule.toFormat(String)
CalculatorPlugin.HydrogenData
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, explicitHydrogens, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, KEEP_HYDROGENS, keepHydrogens, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED, TRUE
Constructor and Description |
---|
IUPACNamingPlugin() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRepeat()
Returns
true if repeatedly running the same plugin object
while getting the results on the GUI is allowed, false otherwise. |
void |
checkMolecule(Molecule mol)
Checks the input molecule.
|
java.lang.String |
getCASNumber()
Returns the CAS number via public web service.
|
java.lang.String |
getErrorMessage()
Returns the calculation error information message if
CalculatorPlugin.run()
returned false (calculation error). |
java.lang.String |
getPreferredIUPACName()
Returns the preferred IUPAC name.
|
java.lang.String |
getProductName()
Returns the product identifier of the plugin as given by
LicenseManager . |
java.lang.Object |
getResult(java.lang.Object type,
int index)
Returns the result item for the specified key and index.
|
java.lang.String |
getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result in String format.
|
Molecule |
getResultMolecule()
Returns the result molecule for display.
|
java.lang.Object[] |
getResultTypes()
Returns the result types.
|
java.lang.String |
getTraditionalName()
Returns the traditional IUPAC name.
|
java.lang.String |
getTypeString(java.lang.Object type)
Returns a string representation of the given type.
|
boolean |
handlesMultiFragmentMolecules()
Returns
true if the plugin handles multifragment molecules, false otherwise. |
boolean |
run()
Runs the tool.
|
void |
setGenerateCASNumber(boolean g)
Sets CAS number name generation.
|
void |
setGeneratePreferredIUPACName(boolean g)
Sets preferred IUPAC name generation.
|
void |
setGenerateTraditionalIUPACName(boolean g)
Sets traditional IUPAC name generation.
|
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule.
|
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin.
|
void |
standardize(Molecule mol)
Standardizes the molecule.
|
arrangeHydrogenIncerments, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getOriginalMolecule, getpH, getPluginResource, getQueryMoleculeErrorMessage, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultCount, getResultDomain, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getWarningMessage, isInputMoleculeAromatized, isLicensed, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
public boolean canRepeat()
CalculatorPlugin
true
if repeatedly running the same plugin object
while getting the results on the GUI is allowed, false
otherwise.
For internal use.canRepeat
in class CalculatorPlugin
true
if allowed, false
otherwisepublic void checkMolecule(Molecule mol)
CalculatorPlugin
checkMolecule
in class CalculatorPlugin
mol
- is the input moleculepublic java.lang.String getCASNumber() throws PluginException
PluginException
- if name generation failsetGenerateCASNumber(boolean)
public java.lang.String getErrorMessage()
CalculatorPlugin
CalculatorPlugin.run()
returned false
(calculation error).
The default implementation returns the empty string.getErrorMessage
in class CalculatorPlugin
public java.lang.String getPreferredIUPACName() throws PluginException
PluginException
- if name generation failsetGeneratePreferredIUPACName(boolean)
public java.lang.String getProductName()
LicenseManager
.getProductName
in class CalculatorPlugin
LicenseManager.STRUCTURE_TO_NAME
public java.lang.Object getResult(java.lang.Object type, int index) throws PluginException
getResult
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexPluginException
- if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
getResultAsString
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result itemPluginException
- if an invalid result item is givenpublic Molecule getResultMolecule() throws PluginException
MolAtom.getExtraLabel()
).
Molecular results are stored in molecule properties
with keys being the result types
(Molecule.getProperty(String)
).getResultMolecule
in class CalculatorPlugin
PluginException
- on errorpublic java.lang.Object[] getResultTypes()
getResultTypes
in class CalculatorPlugin
public java.lang.String getTraditionalName() throws PluginException
PluginException
- if name generation failsetGenerateTraditionalIUPACName(boolean)
public java.lang.String getTypeString(java.lang.Object type)
type.toString()
.getTypeString
in class CalculatorPlugin
type
- is the type objectpublic boolean handlesMultiFragmentMolecules()
true
if the plugin handles multifragment molecules, false
otherwise. In the latter case the plugin takes the fragment with more atoms if a multifragment
molecule is given as input. Returns true
if parameter "single" is set to "false", false
otherwise (default: false
).handlesMultiFragmentMolecules
in class CalculatorPlugin
public boolean run()
run
in class CalculatorPlugin
CalculatorPlugin.getErrorMessage()
public void setGenerateCASNumber(boolean g)
g
- if true
then CAS number is generatedgetCASNumber()
public void setGeneratePreferredIUPACName(boolean g)
g
- if true
then preferred IUPAC name is generatedgetPreferredIUPACName()
public void setGenerateTraditionalIUPACName(boolean g)
g
- if true
then traditional IUPAC name is generatedgetTraditionalName()
public void setParameters(java.util.Properties params) throws PluginException
setParameters
in class CalculatorPlugin
params
- is the parameter tablePluginException
- on errorpublic void standardize(Molecule mol)
standardize
in class CalculatorPlugin
mol
- is the molecule to be standardizedprotected void setInputMolecule(Molecule mol) throws PluginException
setInputMolecule
in class CalculatorPlugin
mol
- is the input moleculePluginException
- on error