Package chemaxon.standardizer.runner
Class BasicStandardizerRunner
java.lang.Object
chemaxon.standardizer.runner.BasicStandardizerRunner
- All Implemented Interfaces:
StandardizerActionRunner
,Cloneable
This is the default implementation of
StandardizerActionRunner
interface.
If the provided molecule is null or contains errors
IllegalArgumentException
should be thrown during the standardization
procedure.
Logs are generated to a System.Logger
, that can be collected by using
StandardizerLogger.getLogger()
method.
- Since:
- 5.11
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBasicStandardizerRunner
(StandardizerConfigurationReader configurationReader) Initialize aBasicStandardizerRunner
instance with theStandardizerConfiguration
read from the provided configuration reader.BasicStandardizerRunner
(StandardizerConfiguration configuration) Initialize aBasicStandardizerRunner
instance with specifiedStandardizerConfiguration
. -
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 threadclone()
Gets the list of actions applied in the configuration at the last executionGets the list of changes applied on the molecule.protected PropertyChangeSupport
Returns the changeSupportGets the configuration of the runnerint
Gets the current progress percentGets whichStandardizerAction
instance run currentlyprotected int
getIndex()
Returns the index of the actual action of the configurationReturns the target moleculeint
Gets the length of the standardization processprotected Runnable
Returns the strategy to use.String[]
Gets the target action groups of the standardizerprotected boolean
Returns whether the process is cancelledboolean
This function identifies the state of the standardizer threadprotected void
setCanceled
(boolean canceled) Sets whether the process is cancelledprotected void
setChangeSupport
(PropertyChangeSupport changeSupport) Sets the changeSupportvoid
setConfiguration
(StandardizerConfiguration configuration) Sets the configuration of the runnervoid
setConfigurationReader
(StandardizerConfigurationReader configurationReader) Sets a new configuration for the runner.void
setIgnoreConfigurationErrors
(boolean ignore) Sets whether configuration errors should be ignoredprotected void
setIndex
(int index) Sets the index of the actual action of the configurationvoid
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.
-
Field Details
-
molecule
TheMolecule
instance to standardize -
backgroundThread
-
-
Constructor Details
-
BasicStandardizerRunner
Initialize aBasicStandardizerRunner
instance with theStandardizerConfiguration
read from the provided configuration reader.- Parameters:
configurationReader
- aStandardizerConfigurationReader
instance, containing the configuration of the standardization process
-
BasicStandardizerRunner
Initialize aBasicStandardizerRunner
instance with specifiedStandardizerConfiguration
.- Parameters:
configuration
- the configuration of the standardization procedure
-
-
Method Details
-
setConfigurationReader
Description copied from interface:StandardizerActionRunner
Sets a new configuration for the runner.- Specified by:
setConfigurationReader
in interfaceStandardizerActionRunner
- Parameters:
configurationReader
- is theStandardizerConfigurationReader
instance which provides the current configuration
-
setMolecule
Description copied from interface:StandardizerActionRunner
Sets the molecule to be standardized by the standardizer actions- Specified by:
setMolecule
in interfaceStandardizerActionRunner
- Parameters:
molecule
- aMolecule
instance to be standardized
-
standardize
Description copied from interface:StandardizerActionRunner
Invoke a background thread which will run all standardizer actions on the given molecule- Specified by:
standardize
in interfaceStandardizerActionRunner
- Throws:
IllegalArgumentException
- if the configuration or the molecule contains errors
-
cancel
public void cancel()Description copied from interface:StandardizerActionRunner
Stops the background thread- Specified by:
cancel
in interfaceStandardizerActionRunner
-
getCurrent
public int getCurrent()Description copied from interface:StandardizerActionRunner
Gets the current progress percent- Specified by:
getCurrent
in interfaceStandardizerActionRunner
- Returns:
- the current progress percent
-
getCurrentActionName
Description copied from interface:StandardizerActionRunner
Gets whichStandardizerAction
instance run currently- Specified by:
getCurrentActionName
in interfaceStandardizerActionRunner
- Returns:
- which
StandardizerAction
instance run currently
-
getProgessLength
public int getProgessLength()Description copied from interface:StandardizerActionRunner
Gets the length of the standardization process- Specified by:
getProgessLength
in interfaceStandardizerActionRunner
- Returns:
- the length of the standardization process
-
isRunning
public boolean isRunning()Description copied from interface:StandardizerActionRunner
This function identifies the state of the standardizer thread- Specified by:
isRunning
in interfaceStandardizerActionRunner
- Returns:
- true if the background thread runs false otherwise
-
addPropertyChangeListener
Description copied from interface:StandardizerActionRunner
Adds aPropertyChangeListener
that will receive all thePropertyChangeEvent
fired by this class- Specified by:
addPropertyChangeListener
in interfaceStandardizerActionRunner
- Parameters:
changeListener
- aPropertyChangeListener
instance
-
addPropertyChangeListener
Description copied from interface:StandardizerActionRunner
Adds aPropertyChangeListener
that will receive thePropertyChangeEvent
fired when the property with the given name is changed- Specified by:
addPropertyChangeListener
in interfaceStandardizerActionRunner
- Parameters:
propertyName
- the name of the property to be listenedlistener
- aPropertyChangeListener
instance
-
standardizeAndWait
Description copied from interface:StandardizerActionRunner
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.- Specified by:
standardizeAndWait
in interfaceStandardizerActionRunner
- Returns:
- the list of changes applied on the molecule
- Throws:
IllegalArgumentException
- if the configuration or the molecule contains errors
-
getStrategy
Returns the strategy to use.- Returns:
- the strategy
-
setCanceled
protected void setCanceled(boolean canceled) Sets whether the process is cancelled- Parameters:
canceled
- whether the process should be cancelled
-
isCanceled
protected boolean isCanceled()Returns whether the process is cancelled- Returns:
- whether the process is cancelled
-
setIndex
protected void setIndex(int index) Sets the index of the actual action of the configuration- Parameters:
index
- the index of the actual action of the configuration
-
getIndex
protected int getIndex()Returns the index of the actual action of the configuration- Returns:
- the index of the actual action of the configuration
-
setConfiguration
Description copied from interface:StandardizerActionRunner
Sets the configuration of the runner- Specified by:
setConfiguration
in interfaceStandardizerActionRunner
- Parameters:
configuration
- the configuration to be set to the runner
-
getMolecule
Returns the target molecule- Returns:
- the target molecule
-
setChangeSupport
Sets the changeSupport- Parameters:
changeSupport
- the changeSupport to be set
-
getChangeSupport
Returns the changeSupport- Returns:
- the changeSupport
-
getConfiguration
Description copied from interface:StandardizerActionRunner
Gets the configuration of the runner- Specified by:
getConfiguration
in interfaceStandardizerActionRunner
- Returns:
- the configuration of the runner
-
getAppliedActions
Description copied from interface:StandardizerActionRunner
Gets the list of actions applied in the configuration at the last execution- Specified by:
getAppliedActions
in interfaceStandardizerActionRunner
- Returns:
- the list of applied actions at the last execution
-
setTargetGroup
Description copied from interface:StandardizerActionRunner
Sets the target group of standardizer action of the runner- Specified by:
setTargetGroup
in interfaceStandardizerActionRunner
- Parameters:
groupName
- the name of the group of standardizer actions
-
setTargetGroups
Description copied from interface:StandardizerActionRunner
Sets the target groups of standardizer action of the runner- Specified by:
setTargetGroups
in interfaceStandardizerActionRunner
- Parameters:
groupNames
- the names of the groups of standardizer actions
-
getTargetGroups
Gets the target action groups of the standardizer- Returns:
- the target action groups of the standardizer
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
setLicenseEnvironment
Description copied from interface:StandardizerActionRunner
Sets the license environment of the runner- Specified by:
setLicenseEnvironment
in interfaceStandardizerActionRunner
- Parameters:
env
- the license environment of the runner
-
getChanges
Description copied from interface:StandardizerActionRunner
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.- Specified by:
getChanges
in interfaceStandardizerActionRunner
- Returns:
- the list of changes applied on the molecule
-
setIgnoreConfigurationErrors
public void setIgnoreConfigurationErrors(boolean ignore) Description copied from interface:StandardizerActionRunner
Sets whether configuration errors should be ignored- Specified by:
setIgnoreConfigurationErrors
in interfaceStandardizerActionRunner
- Parameters:
ignore
- whether configuration errors should be ignored
-