Class IUPACNamingPlugin

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

@PublicApi 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();
 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.

Since:
Marvin 4.1.7, 03/12/2007
See Also:
  • Constructor Details

    • IUPACNamingPlugin

      public IUPACNamingPlugin()
  • Method Details

    • 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
    • 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
    • getCASNumber

      public String getCASNumber() throws PluginException
      Returns the CAS number via public web service.
      Returns:
      the CAS number
      Throws:
      PluginException - if name generation fail
      See Also:
    • getErrorMessage

      public String getErrorMessage()
      Description copied from class: CalculatorPlugin
      Returns the calculation error information message if CalculatorPlugin.run() returned false (calculation error). The default implementation returns the empty string.
      Overrides:
      getErrorMessage in class CalculatorPlugin
      Returns:
      the calculation error information message
    • getPreferredIUPACName

      public String getPreferredIUPACName() throws PluginException
      Returns the preferred IUPAC name.
      Returns:
      the preferred IUPAC name
      Throws:
      PluginException - if name generation fail
      See Also:
    • getProductName

      public 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
    • getResult

      public Object getResult(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:
    • getResultAsString

      public String getResultAsString(Object type, int index, 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
      Description copied from class: CalculatorPlugin
      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 (MPropHandler.convertToString(MPropertyContainer, String)).
      Overrides:
      getResultMolecule in class CalculatorPlugin
      Returns:
      the result molecule
      Throws:
      PluginException - on error
    • getResultTypes

      public Object[] getResultTypes()
      Returns the result types.
      Overrides:
      getResultTypes in class CalculatorPlugin
      Returns:
      the result types
    • getTraditionalName

      public String getTraditionalName() throws PluginException
      Returns the traditional IUPAC name.
      Returns:
      the traditional IUPAC name
      Throws:
      PluginException - if name generation fail
      See Also:
    • getTypeString

      public String getTypeString(Object type)
      Description copied from class: CalculatorPlugin
      Returns a string representation of the given type. The default implementation returns type.toString().
      Overrides:
      getTypeString in class CalculatorPlugin
      Parameters:
      type - is the type object
      Returns:
      the type string
    • 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
    • run

      public boolean run()
      Description copied from class: CalculatorPlugin
      Runs the tool.
      Specified by:
      run in class CalculatorPlugin
      Returns:
      true if the calculation was successful, false on calculation problems
      See Also:
    • setGenerateCASNumber

      public void setGenerateCASNumber(boolean g)
      Sets CAS number name generation. CAS number is fetched using a public web service.
      Parameters:
      g - if true then CAS number is generated
      Since:
      Marvin 5.0
      See Also:
    • 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:
    • 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:
    • setParameters

      public void setParameters(Properties params) throws PluginException
      Description copied from class: CalculatorPlugin
      Sets the input parameters for the plugin.
      Overrides:
      setParameters in class CalculatorPlugin
      Parameters:
      params - is the parameter table
      Throws:
      PluginException - on error
    • 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
    • setInputMolecule

      protected void setInputMolecule(Molecule mol) throws PluginException
      Description copied from class: CalculatorPlugin
      Sets the input molecule.
      Specified by:
      setInputMolecule in class CalculatorPlugin
      Parameters:
      mol - is the input molecule
      Throws:
      PluginException - on error