Package chemaxon.standardizer.actions
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 Summary
Fields Modifier and Type Field Description static String
PROPERTY_KEY_ALLOW_VALENCE_ERROR
Property key for serialization/deserialization an event changes for valence check (boolean value type)static String
PROPERTY_KEY_QUERY_ATOM
Property key for serialization/deserialization an event changes for query atom (MolAtom value type)static String
PROPERTY_KEY_REPLACE_ATOM
Property key for serialization/deserialization an event changes for replace atom (MolAtom value type)-
Fields inherited from class chemaxon.standardizer.AbstractStandardizerAction
CONFIG_PATH_KEY, FORMAT_KEY, ID_KEY, support
-
-
Constructor Summary
Constructors Constructor Description ReplaceAtomsAction(Map<String,String> params)
Initializes a replace atom standardizer action
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReplaceAtomsAction
clone()
MolAtom
getQueryAtom()
Gets the atom to be searched for by the action (the query atom)MolAtom
getReplaceAtom()
Gets the atom to replaced with by the actionboolean
isAllowValenceError()
Gets whether replace should be applied even in case of invalid valence in the resultprotected boolean
matches(MolAtom atom, MolAtom queryAtom)
Matches 2 atomsprotected boolean
replace(MolAtom atom, MolAtom replaceAtom, Molecule molecule)
Replaces an atom to the replace atom in the target moleculevoid
setAllowValenceError(boolean allowValenceError)
Sets replace should be applied even in case of invalid valence in the resultvoid
setQueryAtom(MolAtom queryAtom)
Sets the atom to be searched for by the action (the query atom)void
setReplaceAtom(MolAtom replaceAtom)
Sets the atom to replaced with by the actionprotected Changes
standardize1(Molecule molecule)
This method contains the current standardization mechanism.String
toString()
-
Methods inherited from class chemaxon.standardizer.AbstractStandardizerAction
addPropertyChangeListener, addPropertyChangeListener, anyBooleanPropertyTrue, cloneItem, getComponents, getDescriptor, getID, isActive, isAvailable, isLicensed, isValid, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setActive, setID, setLicenseEnvironment, setValid, standardize
-
-
-
-
Field Detail
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Method Detail
-
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 methodAbstractStandardizerAction.getComponents(Molecule)
, andAbstractStandardizerAction.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 aLogger
, that can be collected by usingStandardizerLogger.getLogger()
method.- Specified by:
standardize1
in classAbstractStandardizerAction
- Parameters:
molecule
- theMolecule
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 replacedreplaceAtom
- the atom to replace withmolecule
- the parent molecule
-
matches
protected boolean matches(MolAtom atom, MolAtom queryAtom)
Matches 2 atoms- Parameters:
atom
- the first atomqueryAtom
- 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
public ReplaceAtomsAction clone() throws CloneNotSupportedException
- Overrides:
clone
in classAbstractStandardizerAction
- Throws:
CloneNotSupportedException
-
toString
public String toString()
- Overrides:
toString
in classAbstractStandardizerAction
-
-