Package chemaxon.standardizer.runner
Interface StandardizerActionRunner
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
BasicStandardizerRunner
The descendant of
As standardizer configuration may contain actions in groups, using
By default, in case of the provided configuration containing error(s) the runner throws
If errors of configuration needs to be checked, use the
Standardization can be executed by
The applied standardizer actions can be collected using
Logs are generated to a
Note, that
StandardizerActionRunner
interface has to provide
the functionality to run StandardizerConfiguration
instances
automatically on the given molecule.As standardizer configuration may contain actions in groups, using
setTargetGroup(String)
and setTargetGroups(String...)
methods, the target groups, containing the actions to be executed can be
defined.By default, in case of the provided configuration containing error(s) the runner throws
IllegalArgumentException
. Configuration errors can be
ignored using the method
setIgnoreConfigurationErrors(boolean)
with
true as parameter. In this case the faulty actions are not executed, error
message or exception should not occur! If errors of configuration needs to be checked, use the
getConfiguration()
method to get the
configuration, and check the validity of the configuration by using the
function StandardizerConfiguration.isValid()
.Standardization can be executed by
standardize()
and
standardizeAndWait()
method. The method standardize()
executes the standardization in a background thread. The state of the
standardization can be gathered using isRunning()
method. Using
standardizeAndWait()
method the thread is blocked until the
standardization finishes. The applied standardizer actions can be collected using
getAppliedActions()
, and the changes applied on the molecule can be
collected using getChanges()
method.Logs are generated to a
System.Logger
, that can be collected by using
StandardizerLogger.getLogger()
method.Note, that
setMolecule(Molecule)
method must be called prior
standardization.- Since:
- 5.11
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener changeListener) Adds aPropertyChangeListener
that will receive all thePropertyChangeEvent
fired by this classvoid
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) Adds aPropertyChangeListener
that will receive thePropertyChangeEvent
fired when the property with the given name is changedvoid
cancel()
Stops the background threadGets the list of actions applied in the configuration at the last executionGets the list of changes applied on the molecule.Gets the configuration of the runnerint
Gets the current progress percentGets whichStandardizerAction
instance run currentlyint
Gets the length of the standardization processboolean
This function identifies the state of the standardizer threadvoid
setConfiguration
(StandardizerConfiguration configuration) Sets the configuration of the runnervoid
Sets a new configuration for the runner.void
setIgnoreConfigurationErrors
(boolean ignore) Sets whether configuration errors should be ignoredvoid
Sets the license environment of the runnervoid
setMolecule
(Molecule molecule) Sets the molecule to be standardized by the standardizer actionsvoid
setTargetGroup
(String groupName) Sets the target group of standardizer action of the runnervoid
setTargetGroups
(String... groupNames) Sets the target groups of standardizer action of the runnervoid
Invoke a background thread which will run all standardizer actions on the given moleculeExecutes all standardizer actions contained by the pre-set configuration on the given molecule and returns the list of applied changes.
-
Method Details
-
setConfigurationReader
Sets a new configuration for the runner.- Parameters:
reader
- is theStandardizerConfigurationReader
instance which provides the current configuration
-
standardize
Invoke a background thread which will run all standardizer actions on the given molecule- Throws:
IllegalArgumentException
- if the configuration or the molecule contains errors
-
standardizeAndWait
Executes all standardizer actions contained by the pre-set configuration on the given molecule and returns the list of applied changes. For each action of the configuration there is a change object (or null) in the list.- Returns:
- the list of changes applied on the molecule
- Throws:
IllegalArgumentException
- if the configuration or the molecule contains errors
-
cancel
void cancel()Stops the background thread -
isRunning
boolean isRunning()This function identifies the state of the standardizer thread- Returns:
- true if the background thread runs false otherwise
-
getCurrent
int getCurrent()Gets the current progress percent- Returns:
- the current progress percent
-
getCurrentActionName
String getCurrentActionName()Gets whichStandardizerAction
instance run currently- Returns:
- which
StandardizerAction
instance run currently
-
getProgessLength
int getProgessLength()Gets the length of the standardization process- Returns:
- the length of the standardization process
-
getChanges
Gets the list of changes applied on the molecule. For each action of the configuration there is a change object (or null) in the list.- Returns:
- the list of changes applied on the molecule
-
setMolecule
Sets the molecule to be standardized by the standardizer actions- Parameters:
molecule
- aMolecule
instance to be standardized
-
addPropertyChangeListener
Adds aPropertyChangeListener
that will receive all thePropertyChangeEvent
fired by this class- Parameters:
changeListener
- aPropertyChangeListener
instance
-
addPropertyChangeListener
Adds aPropertyChangeListener
that will receive thePropertyChangeEvent
fired when the property with the given name is changed- Parameters:
propertyName
- the name of the property to be listenedlistener
- aPropertyChangeListener
instance
-
getConfiguration
StandardizerConfiguration getConfiguration()Gets the configuration of the runner- Returns:
- the configuration of the runner
-
setConfiguration
Sets the configuration of the runner- Parameters:
configuration
- the configuration to be set to the runner
-
getAppliedActions
List<StandardizerAction> getAppliedActions()Gets the list of actions applied in the configuration at the last execution- Returns:
- the list of applied actions at the last execution
-
setTargetGroup
Sets the target group of standardizer action of the runner- Parameters:
groupName
- the name of the group of standardizer actions
-
setTargetGroups
Sets the target groups of standardizer action of the runner- Parameters:
groupNames
- the names of the groups of standardizer actions
-
setLicenseEnvironment
Sets the license environment of the runner- Parameters:
env
- the license environment of the runner
-
setIgnoreConfigurationErrors
void setIgnoreConfigurationErrors(boolean ignore) Sets whether configuration errors should be ignored- Parameters:
ignore
- whether configuration errors should be ignored
-