Class AbstractStandardizerAction

    • Constructor Detail

      • AbstractStandardizerAction

        protected AbstractStandardizerAction​(Map<String,​String> params)
        Initializes 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 Detail

      • isValid

        public boolean isValid()
        Description copied from interface: StandardizerAction
        Returns true if the action's parameters are valid, false otherwise
        Specified by:
        isValid in interface StandardizerAction
        Returns:
        true if the action's parameters are valid, false otherwise
      • setValid

        public 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 constructor AbstractStandardizerAction(Map)
        If a descendant standardizer action has an invalid parameter, the validity should be false.
        Parameters:
        valid - the validity of the standardizer action
      • isAvailable

        public boolean isAvailable()
        Description copied from interface: StandardizerAction
        Returns true if the action is available, and can be used
        Specified by:
        isAvailable in interface StandardizerAction
        Returns:
        true if the action is available, and can be used
      • standardize

        public final Changes standardize​(Molecule molecule)
        Description copied from interface: StandardizerAction
        Standardizes the provided molecule.
        Logs of standardization should be generated to a Logger, that can be collected by using StandardizerLogger.getLogger() method.
        Specified by:
        standardize in interface StandardizerAction
        Parameters:
        molecule - the target molecule of the standardization process
        Returns:
        the change set of the molecule
      • standardize1

        protected abstract Changes standardize1​(Molecule molecule)
                                         throws IllegalArgumentException
        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 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.
        Logs of standardization should be generated to a Logger, that can be collected by using StandardizerLogger.getLogger() method.
        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
      • removePropertyChangeListener

        public void removePropertyChangeListener​(String propertyName,
                                                 PropertyChangeListener listener)
        Description copied from interface: StandardizerAction
        Remove a PropertyChangeListener for a specific property. If listener was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If propertyName is null, no exception is thrown and no action is taken. If listener is null, or was never added for the specified property, no exception is thrown and no action is taken.
        Specified by:
        removePropertyChangeListener in interface StandardizerAction
        Parameters:
        propertyName - The name of the property that was listened on.
        listener - The PropertyChangeListener to be removed
        See Also:
        PropertyChangeSupport.removePropertyChangeListener(String, PropertyChangeListener)
      • addPropertyChangeListener

        public void addPropertyChangeListener​(String propertyName,
                                              PropertyChangeListener listener)
        Description copied from interface: StandardizerAction
        Add 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. If propertyName or listener is null, no exception is thrown and no action is taken.
        Specified by:
        addPropertyChangeListener in interface StandardizerAction
        Parameters:
        propertyName - The name of the property to listen on.
        listener - The PropertyChangeListener to be added
        See Also:
        PropertyChangeSupport.addPropertyChangeListener(String, PropertyChangeListener)
      • setLicenseEnvironment

        public void setLicenseEnvironment​(String env)
        Description copied from interface: StandardizerAction
        Sets the license environment of the action
        Specified by:
        setLicenseEnvironment in interface chemaxon.license.Licensable
        Specified by:
        setLicenseEnvironment in interface StandardizerAction
        Parameters:
        env - the license environment of the action
      • isLicensed

        public boolean isLicensed()
        Specified by:
        isLicensed in interface chemaxon.license.Licensable
      • getID

        public String getID()
        Gets the identifier string of the standardizer action.
        Specified by:
        getID in interface StandardizerAction
        Returns:
        the identifier string of the standardizer action
      • setID

        public void setID​(String id)
        Sets the identifier string of the standardizer action
        Parameters:
        id - the identifier string of the standardizer action
      • isActive

        public boolean isActive()
        Description copied from interface: StandardizerAction
        Returns true if the action is active, and can be used
        Specified by:
        isActive in interface StandardizerAction
        Returns:
        true if the action is active, and can be used
      • setActive

        public void setActive​(boolean active)
        Description copied from interface: StandardizerAction
        Sets whether the action is active, and can be used
        Specified by:
        setActive in interface StandardizerAction
        Parameters:
        active - whether the action should be active, and can be used
      • getComponents

        protected List<Molecule> getComponents​(Molecule molecule)
        A 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