Package chemaxon.standardizer
Class AbstractStandardizerAction
java.lang.Object
chemaxon.standardizer.AbstractStandardizerAction
- All Implemented Interfaces:
- chemaxon.license.Licensable,- StandardizerAction,- PropertyChangeListener,- Cloneable,- EventListener
- Direct Known Subclasses:
- AbsoluteStereoAction,- AbstractSgroupAction,- AddExplicitHydrogensAction,- AliasToAtomAction,- AliasToGroupAction,- AromatizeAction,- Clean2DAction,- Clean3DAction,- ClearIsotopesAction,- ClearStereoAction,- ConvertDoubleBondsAction,- ConvertPiMetalBondsAction,- ConvertToEnhancedStereoAction,- CreateGroupAction,- DearomatizeAction,- DisconnectMetalAtomsAction,- ExpandAction,- MapAction,- MapReactionAction,- MesomerizeAction,- NeutralizeAction,- RearrangeReactionAction,- RemoveAbsoluteStereoAction,- RemoveAtomValuesAction,- RemoveAttachedDataAction,- RemoveExplicitHydrogensAction,- RemoveFragmentAction,- RemoveRGroupDefinitionsAction,- RemoveSolventsAction,- RemoveStereoCareBoxAction,- ReplaceAtomsAction,- SetAbsoluteStereoAction,- SetHydrogenIsotopeSymbolAction,- StripSaltsAction,- TautomerizeAction,- TransformAction,- UnmapAction,- WedgeCleanAction
@PublicApi
public abstract class AbstractStandardizerAction
extends Object
implements StandardizerAction, chemaxon.license.Licensable, Cloneable, PropertyChangeListener
Abstract implementation of the 
 
StandardizerAction. 
 The abstract implementation manages license checking, availability, validity
 of the action, manages the Changes, and collecting information for mapping. 
 
 The standardization process of the target molecule must be implemented by the
 method standardize1(Molecule)
 
 Special molecules containing more components (e.g. RgMolecule,
 RxnMolecule) are decomponented by the method
 getComponents(Molecule), and 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.
- Since:
- 5.11
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe key of configuration path parameter of the abstract action.static final StringThe key of the molecule format parameter of the abstract action.static final StringThe key of the ID parameter of the abstract action.protected PropertyChangeSupport
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractStandardizerAction(Map<String, String> params) Initializes the functionality of the abstract implementation.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a PropertyChangeListener to the listener list.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Add a PropertyChangeListener for a specific property.protected booleananyBooleanPropertyTrue(Map<String, String> params, String... keys) Check the given map, whether there is a String 'true' (case in-sensitive) value for any of the given keysclone()Returns a clone of thisStandardizerActioninstancegetComponents(Molecule molecule) A recursive algorithm getting all components (reactants, agents and products of reaction molecules, R-group definitions of Rg-Molecules) of the molecule.Gets the descriptor of the standardizer action.getID()Gets the identifier string of the standardizer action.booleanisActive()Returns true if the action is active, and can be usedbooleanReturns true if the action is available, and can be usedbooleanbooleanisValid()Returns true if the action's parameters are valid, false otherwisevoidvoidRemove a PropertyChangeListener from the listener list.voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Remove a PropertyChangeListener for a specific property.voidsetActive(boolean active) Sets whether the action is active, and can be usedvoidSets the identifier string of the standardizer actionvoidSets the license environment of the actionvoidsetValid(boolean valid) Sets the validity of the standardizer action.final Changesstandardize(Molecule molecule) Callsstandardize1(Molecule)
 If molecule has more componentsstandardize1(Molecule)is invoked on all components instead of the molecule itself.
 Ifstandardize1(Molecule)doesn't return a not null Change object for the molecule or for any of the components the value of the returned changes object'sChanges.isModified()property is set based on whether molecule'sMoleculeGraph.getGrinvCC()property value has changed during the standardization action.protected abstract Changesstandardize1(Molecule molecule) This method contains the current standardization mechanism.toString()
- 
Field Details- 
CONFIG_PATH_KEYThe key of configuration path parameter of the abstract action. The map provided in the constructorAbstractStandardizerAction(Map)may contain the value of the path of the configuration defined by this key.- See Also:
 
- 
ID_KEYThe key of the ID parameter of the abstract action. The map provided in the constructorAbstractStandardizerAction(Map)may contain the value of the identifier of the action defined by this key.- See Also:
 
- 
FORMAT_KEYThe key of the molecule format parameter of the abstract action. The map provided in the constructorAbstractStandardizerAction(Map)may contain the value of the identifier of the action defined by this key.- See Also:
 
- 
support
 
- 
- 
Constructor Details- 
AbstractStandardizerActionInitializes the functionality of the abstract implementation. Sets the ID of the action, if it is provided, and starts property change observing on the descriptor- Parameters:
- params- the parameters of the action in a map representation
 
 
- 
- 
Method Details- 
getDescriptorDescription copied from interface:StandardizerActionGets the descriptor of the standardizer action. Contains all necessary informations of the action for user interfaces.- Specified by:
- getDescriptorin interface- StandardizerAction
- Returns:
- the descriptor of the standardizer action.
 
- 
isValidpublic boolean isValid()Description copied from interface:StandardizerActionReturns true if the action's parameters are valid, false otherwise- Specified by:
- isValidin interface- StandardizerAction
- Returns:
- true if the action's parameters are valid, false otherwise
 
- 
setValidpublic void setValid(boolean valid) Sets the validity of the standardizer action. The validity of the standardizer action depends on the validity of the provided parameters of the constructorAbstractStandardizerAction(Map)
 If a descendant standardizer action has an invalid parameter, the validity should be false. - Parameters:
- valid- the validity of the standardizer action
 
- 
isAvailablepublic boolean isAvailable()Description copied from interface:StandardizerActionReturns true if the action is available, and can be used- Specified by:
- isAvailablein interface- StandardizerAction
- Returns:
- true if the action is available, and can be used
 
- 
standardizeCallsstandardize1(Molecule)
 If molecule has more componentsstandardize1(Molecule)is invoked on all components instead of the molecule itself.
 Ifstandardize1(Molecule)doesn't return a not null Change object for the molecule or for any of the components the value of the returned changes object'sChanges.isModified()property is set based on whether molecule'sMoleculeGraph.getGrinvCC()property value has changed during the standardization action.- Specified by:
- standardizein interface- StandardizerAction
- Parameters:
- molecule- the target molecule of the standardization process
- Returns:
- the change set of the molecule
 
- 
standardize1This 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 methodgetComponents(Molecule), andstandardize1(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.- Parameters:
- molecule- the- Moleculeinstance 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
 
- 
cloneItemDescription copied from interface:StandardizerActionReturns a clone of thisStandardizerActioninstance- Specified by:
- cloneItemin interface- StandardizerAction
- Returns:
- a clone of this StandardizerActioninstance
 
- 
clone- Overrides:
- clonein class- Object
- Throws:
- CloneNotSupportedException
 
- 
removePropertyChangeListenerDescription copied from interface:StandardizerActionRemove a PropertyChangeListener for a specific property. Iflistenerwas added more than once to the same event source for the specified property, it will be notified one less time after being removed. IfpropertyNameis null, no exception is thrown and no action is taken. Iflisteneris null, or was never added for the specified property, no exception is thrown and no action is taken.- Specified by:
- removePropertyChangeListenerin interface- StandardizerAction
- Parameters:
- propertyName- The name of the property that was listened on.
- listener- The PropertyChangeListener to be removed
- See Also:
 
- 
addPropertyChangeListenerDescription copied from interface:StandardizerActionAdd a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property. IfpropertyNameorlisteneris null, no exception is thrown and no action is taken.- Specified by:
- addPropertyChangeListenerin interface- StandardizerAction
- Parameters:
- propertyName- The name of the property to listen on.
- listener- The PropertyChangeListener to be added
- See Also:
 
- 
removePropertyChangeListenerDescription copied from interface:StandardizerActionRemove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. Iflistenerwas added more than once to the same event source, it will be notified one less time after being removed. Iflisteneris null, or was never added, no exception is thrown and no action is taken.- Specified by:
- removePropertyChangeListenerin interface- StandardizerAction
- Parameters:
- listener- The PropertyChangeListener to be removed
- See Also:
 
- 
addPropertyChangeListenerDescription copied from interface:StandardizerActionAdd a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. Iflisteneris null, no exception is thrown and no action is taken.- Specified by:
- addPropertyChangeListenerin interface- StandardizerAction
- Parameters:
- listener- The PropertyChangeListener to be added
- See Also:
 
- 
setLicenseEnvironmentDescription copied from interface:StandardizerActionSets the license environment of the action- Specified by:
- setLicenseEnvironmentin interface- chemaxon.license.Licensable
- Specified by:
- setLicenseEnvironmentin interface- StandardizerAction
- Parameters:
- env- the license environment of the action
 
- 
isLicensedpublic boolean isLicensed()- Specified by:
- isLicensedin interface- chemaxon.license.Licensable
 
- 
toString
- 
propertyChange- Specified by:
- propertyChangein interface- PropertyChangeListener
 
- 
getIDGets the identifier string of the standardizer action.- Specified by:
- getIDin interface- StandardizerAction
- Returns:
- the identifier string of the standardizer action
 
- 
setIDSets the identifier string of the standardizer action- Parameters:
- id- the identifier string of the standardizer action
 
- 
isActivepublic boolean isActive()Description copied from interface:StandardizerActionReturns true if the action is active, and can be used- Specified by:
- isActivein interface- StandardizerAction
- Returns:
- true if the action is active, and can be used
 
- 
setActivepublic void setActive(boolean active) Description copied from interface:StandardizerActionSets whether the action is active, and can be used- Specified by:
- setActivein interface- StandardizerAction
- Parameters:
- active- whether the action should be active, and can be used
 
- 
anyBooleanPropertyTrueCheck the given map, whether there is a String 'true' (case in-sensitive) value for any of the given keys- Parameters:
- params- The map in question
- keys- array of one or more keys, which values we are interested in
- Returns:
- true is returned if 'true' (case in-sensitive) is found for any key in the map, 'false' otherwise
 
- 
getComponentsA recursive algorithm getting all components (reactants, agents and products of reaction molecules, R-group definitions of Rg-Molecules) of the molecule. Used to collect all. If components must not be standardized, this method should be overridden.- Parameters:
- molecule- the target molecule
- Returns:
- the resulted list of components
 
 
-