chemaxon.marvin.calculations
Class IUPACNamingPlugin

java.lang.Object
  extended by chemaxon.marvin.plugin.CalculatorPlugin
      extended by chemaxon.marvin.calculations.IUPACNamingPlugin
All Implemented Interfaces:
chemaxon.license.Licensable

public class IUPACNamingPlugin
extends CalculatorPlugin

IUPAC name generator plugin.

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();

    // do something with the result ...
 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Since:
Marvin 4.1.7, 03/12/2007
Version:
Marvin 5.3.2, 03/12/2009
Author:
Zsolt Mohacsi
See Also:
Molecule.toFormat(String)

Nested Class Summary
 
Nested classes/interfaces inherited from class chemaxon.marvin.plugin.CalculatorPlugin
CalculatorPlugin.HydrogenData
 
Field Summary
 
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin
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 Summary
IUPACNamingPlugin()
           
 
Method Summary
 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 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 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 setLicenseEnvironment(java.lang.String env)
          Sets license environment to be stored.
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void standardize(Molecule mol)
          Standardizes the molecule.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
arrangeHydrogenIncerments, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getErrorMessage, getExplicitHydrogenData, getInputMolDim, getMainMolecule, 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, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setMolecule, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IUPACNamingPlugin

public IUPACNamingPlugin()
Method Detail

setParameters

public void setParameters(java.util.Properties params)
                   throws PluginException
Sets the input parameters for the plugin.

Overrides:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error

handlesMultiFragmentMolecules

public boolean handlesMultiFragmentMolecules()
Returns 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).

Overrides:
handlesMultiFragmentMolecules in class CalculatorPlugin
Returns:
true if the plugin handles multifragment molecules, false otherwise

checkMolecule

public void checkMolecule(Molecule mol)
Description copied from class: CalculatorPlugin
Checks the input molecule. Throws exception if the molecule is not accepted as input molecule, otherwise does nothing (simply returns). The default implementation refuses query molecules, molecules with SRU S-groups, molecules with multicenter S-groups and molecules with coordinate bonds.

Overrides:
checkMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule

setInputMolecule

protected void setInputMolecule(Molecule mol)
                         throws PluginException
Sets the input molecule.

Specified by:
setInputMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - on error

setGeneratePreferredIUPACName

public void setGeneratePreferredIUPACName(boolean g)
Sets preferred IUPAC name generation.

Parameters:
g - if true then preferred IUPAC name is generated
Since:
Marvin 5.0
See Also:
getPreferredIUPACName()

setGenerateTraditionalIUPACName

public void setGenerateTraditionalIUPACName(boolean g)
Sets traditional IUPAC name generation.

Parameters:
g - if true then traditional IUPAC name is generated
Since:
Marvin 5.0
See Also:
getTraditionalName()

run

public boolean run()
            throws PluginException
Runs the tool.

Specified by:
run in class CalculatorPlugin
Returns:
true if the calculation was successful, false on calculation problems
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getErrorMessage()

getPreferredIUPACName

public java.lang.String getPreferredIUPACName()
                                       throws PluginException
Returns the preferred IUPAC name.

Returns:
the preferred IUPAC name
Throws:
PluginException - if name generation fail
See Also:
setGeneratePreferredIUPACName(boolean)

getTraditionalName

public java.lang.String getTraditionalName()
                                    throws PluginException
Returns the traditional IUPAC name.

Returns:
the traditional IUPAC name
Throws:
PluginException - if name generation fail
See Also:
setGenerateTraditionalIUPACName(boolean)

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the result types.

Overrides:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getTypeString

public java.lang.String getTypeString(java.lang.Object type)
Returns a string representation of the given type.

Overrides:
getTypeString in class CalculatorPlugin
Parameters:
type - is the type object
Returns:
the type string

canRepeat

public boolean canRepeat()
Description copied from class: CalculatorPlugin
Returns true if repeatedly running the same plugin object while getting the results on the GUI is allowed, false otherwise. For internal use.

Overrides:
canRepeat in class CalculatorPlugin
Returns:
true if allowed, false otherwise

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  int index)
                           throws PluginException
Returns the result item for the specified key and index.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
Returns:
the result item for the specified key and index
Throws:
PluginException - if the result cannot be returned
See Also:
CalculatorPlugin.getResultTypes()

getResultAsString

public java.lang.String getResultAsString(java.lang.Object type,
                                          int index,
                                          java.lang.Object result)
                                   throws PluginException
Returns the specified result in String format.

Overrides:
getResultAsString in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
result - is the result item
Returns:
the specified result in String format
Throws:
PluginException - if an invalid result item is given

getResultMolecule

public Molecule getResultMolecule()
                           throws PluginException
Returns the result molecule for display. Atomic results are stored in atom extra labels (MolAtom.getExtraLabel()). Molecular results are stored in molecule properties with keys being the result types (Molecule.getProperty(String)).

Overrides:
getResultMolecule in class CalculatorPlugin
Returns:
the result molecule
Throws:
PluginException - on error

getProductName

public java.lang.String getProductName()
Returns the product identifier of the plugin as given by LicenseManager.

Specified by:
getProductName in class CalculatorPlugin
Returns:
The identifier LicenseManager.STRUCTURE_TO_NAME

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Description copied from class: CalculatorPlugin
Sets license environment to be stored.

Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable
Overrides:
setLicenseEnvironment in class CalculatorPlugin
Parameters:
env - environment String to be stored and passed to the LicenseHandler in the isLicensed method

standardize

public void standardize(Molecule mol)
Standardizes the molecule. Overrides the default standardization.

Overrides:
standardize in class CalculatorPlugin
Parameters:
mol - is the molecule to be standardized