@PublicAPI public class ReplaceAtomsAction extends AbstractStandardizerAction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_KEY_ALLOW_VALENCE_ERROR
Property key for serialization/deserialization an event changes for
valence check (boolean value type)
|
static java.lang.String |
PROPERTY_KEY_QUERY_ATOM
Property key for serialization/deserialization an event changes for query
atom (MolAtom value type)
|
static java.lang.String |
PROPERTY_KEY_REPLACE_ATOM
Property key for serialization/deserialization an event changes for
replace atom (MolAtom value type)
|
CONFIG_PATH_KEY, FORMAT_KEY, ID_KEY, support
Constructor and Description |
---|
ReplaceAtomsAction(java.util.Map<java.lang.String,java.lang.String> params)
Initializes a replace atom standardizer action
|
Modifier and Type | Method and 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 action
|
boolean |
isAllowValenceError()
Gets whether replace should be applied even in case of invalid valence in
the result
|
protected boolean |
matches(MolAtom atom,
MolAtom queryAtom)
Matches 2 atoms
|
protected boolean |
replace(MolAtom atom,
MolAtom replaceAtom,
Molecule molecule)
Replaces an atom to the replace atom in the target molecule
|
void |
setAllowValenceError(boolean allowValenceError)
Sets replace should be applied even in case of invalid valence in the
result
|
void |
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 action
|
protected Changes |
standardize1(Molecule molecule)
This method contains the current standardization mechanism.
|
java.lang.String |
toString() |
addPropertyChangeListener, addPropertyChangeListener, cloneItem, getComponents, getDescriptor, getID, isActive, isAvailable, isLicensed, isValid, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setActive, setID, setLicenseEnvironment, setValid, standardize
public static final java.lang.String PROPERTY_KEY_QUERY_ATOM
public static final java.lang.String PROPERTY_KEY_REPLACE_ATOM
public static final java.lang.String PROPERTY_KEY_ALLOW_VALENCE_ERROR
public ReplaceAtomsAction(java.util.Map<java.lang.String,java.lang.String> params)
params
- the parameters of the actionprotected final Changes standardize1(Molecule molecule) throws java.lang.IllegalArgumentException
AbstractStandardizerAction
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.Logger
, that can
be collected by using StandardizerLogger.getLogger()
method.standardize1
in class AbstractStandardizerAction
molecule
- the Molecule
instance to be standardizedjava.lang.IllegalArgumentException
- if the provided molecule or the provided parameters of the
action are invalidprotected boolean replace(MolAtom atom, MolAtom replaceAtom, Molecule molecule)
atom
- the atom to be replacedreplaceAtom
- the atom to replace withmolecule
- the
parent moleculeprotected boolean matches(MolAtom atom, MolAtom queryAtom)
atom
- the first atomqueryAtom
- the second atompublic MolAtom getQueryAtom()
public void setQueryAtom(MolAtom queryAtom)
queryAtom
- the atom to be searched for by the action (the query atom)public MolAtom getReplaceAtom()
public void setReplaceAtom(MolAtom replaceAtom)
replaceAtom
- the atom to replaced with by the actionpublic boolean isAllowValenceError()
public void setAllowValenceError(boolean allowValenceError)
allowValenceError
- replace should be applied even in case of invalid valence in
the resultpublic ReplaceAtomsAction clone() throws java.lang.CloneNotSupportedException
clone
in class AbstractStandardizerAction
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class AbstractStandardizerAction