Class ReplaceAtomsAction

java.lang.Object
chemaxon.standardizer.AbstractStandardizerAction
chemaxon.standardizer.actions.ReplaceAtomsAction
All Implemented Interfaces:
chemaxon.license.Licensable, StandardizerAction, PropertyChangeListener, Cloneable, EventListener

@PublicAPI public class ReplaceAtomsAction extends AbstractStandardizerAction
Replace atoms standardizer action
Since:
6.0
  • Field Details

    • PROPERTY_KEY_QUERY_ATOM

      public static final String PROPERTY_KEY_QUERY_ATOM
      Property key for serialization/deserialization an event changes for query atom (MolAtom value type)
      See Also:
    • PROPERTY_KEY_REPLACE_ATOM

      public static final String PROPERTY_KEY_REPLACE_ATOM
      Property key for serialization/deserialization an event changes for replace atom (MolAtom value type)
      See Also:
    • PROPERTY_KEY_ALLOW_VALENCE_ERROR

      public static final String PROPERTY_KEY_ALLOW_VALENCE_ERROR
      Property key for serialization/deserialization an event changes for valence check (boolean value type)
      See Also:
  • Constructor Details

    • ReplaceAtomsAction

      public ReplaceAtomsAction(Map<String,String> params)
      Initializes a replace atom standardizer action
      Parameters:
      params - the parameters of the action
  • Method Details

    • standardize1

      protected final Changes standardize1(Molecule molecule) throws IllegalArgumentException
      Description copied from class: AbstractStandardizerAction
      This method contains the current standardization mechanism. Descendants needs to implement this method.
      Special molecules containing more components (e.g. RgMolecule, RxnMolecule) are decomponented by the method AbstractStandardizerAction.getComponents(Molecule), and AbstractStandardizerAction.standardize1(Molecule) method is called on each component, before applied on the original molecule. If a descendant does not want this to occur, this method must be overridden.
      Logs of standardization should be generated to a Logger, that can be collected by using StandardizerLogger.getLogger() method.
      Specified by:
      standardize1 in class AbstractStandardizerAction
      Parameters:
      molecule - the Molecule instance to be standardized
      Returns:
      the changes applied on the molecule during the standardization process
      Throws:
      IllegalArgumentException - if the provided molecule or the provided parameters of the action are invalid
    • replace

      protected boolean replace(MolAtom atom, MolAtom replaceAtom, Molecule molecule)
      Replaces an atom to the replace atom in the target molecule
      Parameters:
      atom - the atom to be replaced
      replaceAtom - the atom to replace with
      molecule - the parent molecule
    • matches

      protected boolean matches(MolAtom atom, MolAtom queryAtom)
      Matches 2 atoms
      Parameters:
      atom - the first atom
      queryAtom - the second atom
      Returns:
      true if the atoms do match
    • getQueryAtom

      public MolAtom getQueryAtom()
      Gets the atom to be searched for by the action (the query atom)
      Returns:
      the atom to be searched for by the action (the query atom)
    • setQueryAtom

      public void setQueryAtom(MolAtom queryAtom)
      Sets the atom to be searched for by the action (the query atom)
      Parameters:
      queryAtom - the atom to be searched for by the action (the query atom)
    • getReplaceAtom

      public MolAtom getReplaceAtom()
      Gets the atom to replaced with by the action
      Returns:
      the atom to replaced with by the action
    • setReplaceAtom

      public void setReplaceAtom(MolAtom replaceAtom)
      Sets the atom to replaced with by the action
      Parameters:
      replaceAtom - the atom to replaced with by the action
    • isAllowValenceError

      public boolean isAllowValenceError()
      Gets whether replace should be applied even in case of invalid valence in the result
      Returns:
      whether replace should be applied even in case of invalid valence in the result
    • setAllowValenceError

      public void setAllowValenceError(boolean allowValenceError)
      Sets replace should be applied even in case of invalid valence in the result
      Parameters:
      allowValenceError - replace should be applied even in case of invalid valence in the result
    • clone

      Overrides:
      clone in class AbstractStandardizerAction
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Overrides:
      toString in class AbstractStandardizerAction