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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicStandardizerRunner(StandardizerConfigurationReader configurationReader) Initialize aBasicStandardizerRunnerinstance with theStandardizerConfigurationread from the provided configuration reader.BasicStandardizerRunner(StandardizerConfiguration configuration) Initialize aBasicStandardizerRunnerinstance with specifiedStandardizerConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener changeListener) Adds aPropertyChangeListenerthat will receive all thePropertyChangeEventfired by this classvoidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds aPropertyChangeListenerthat will receive thePropertyChangeEventfired when the property with the given name is changedvoidcancel()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 PropertyChangeSupportReturns the changeSupportGets the configuration of the runnerintGets the current progress percentGets whichStandardizerActioninstance run currentlyprotected intgetIndex()Returns the index of the actual action of the configurationReturns the target moleculeintGets the length of the standardization processprotected RunnableReturns the strategy to use.String[]Gets the target action groups of the standardizerprotected booleanReturns whether the process is cancelledbooleanThis function identifies the state of the standardizer threadprotected voidsetCanceled(boolean canceled) Sets whether the process is cancelledprotected voidsetChangeSupport(PropertyChangeSupport changeSupport) Sets the changeSupportvoidsetConfiguration(StandardizerConfiguration configuration) Sets the configuration of the runnervoidsetConfigurationReader(StandardizerConfigurationReader configurationReader) Sets a new configuration for the runner.voidsetIgnoreConfigurationErrors(boolean ignore) Sets whether configuration errors should be ignoredprotected voidsetIndex(int index) Sets the index of the actual action of the configurationvoidSets the license environment of the runnervoidsetMolecule(Molecule molecule) Sets the molecule to be standardized by the standardizer actionsvoidsetTargetGroup(String groupName) Sets the target group of standardizer action of the runnervoidsetTargetGroups(String... groupNames) Sets the target groups of standardizer action of the runnervoidInvoke 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
TheMoleculeinstance to standardize -
backgroundThread
-
-
Constructor Details
-
BasicStandardizerRunner
Initialize aBasicStandardizerRunnerinstance with theStandardizerConfigurationread from the provided configuration reader.- Parameters:
configurationReader- aStandardizerConfigurationReaderinstance, containing the configuration of the standardization process
-
BasicStandardizerRunner
Initialize aBasicStandardizerRunnerinstance with specifiedStandardizerConfiguration.- Parameters:
configuration- the configuration of the standardization procedure
-
-
Method Details
-
setConfigurationReader
Description copied from interface:StandardizerActionRunnerSets a new configuration for the runner.- Specified by:
setConfigurationReaderin interfaceStandardizerActionRunner- Parameters:
configurationReader- is theStandardizerConfigurationReaderinstance which provides the current configuration
-
setMolecule
Description copied from interface:StandardizerActionRunnerSets the molecule to be standardized by the standardizer actions- Specified by:
setMoleculein interfaceStandardizerActionRunner- Parameters:
molecule- aMoleculeinstance to be standardized
-
standardize
Description copied from interface:StandardizerActionRunnerInvoke a background thread which will run all standardizer actions on the given molecule- Specified by:
standardizein interfaceStandardizerActionRunner- Throws:
IllegalArgumentException- if the configuration or the molecule contains errors
-
cancel
public void cancel()Description copied from interface:StandardizerActionRunnerStops the background thread- Specified by:
cancelin interfaceStandardizerActionRunner
-
getCurrent
public int getCurrent()Description copied from interface:StandardizerActionRunnerGets the current progress percent- Specified by:
getCurrentin interfaceStandardizerActionRunner- Returns:
- the current progress percent
-
getCurrentActionName
Description copied from interface:StandardizerActionRunnerGets whichStandardizerActioninstance run currently- Specified by:
getCurrentActionNamein interfaceStandardizerActionRunner- Returns:
- which
StandardizerActioninstance run currently
-
getProgessLength
public int getProgessLength()Description copied from interface:StandardizerActionRunnerGets the length of the standardization process- Specified by:
getProgessLengthin interfaceStandardizerActionRunner- Returns:
- the length of the standardization process
-
isRunning
public boolean isRunning()Description copied from interface:StandardizerActionRunnerThis function identifies the state of the standardizer thread- Specified by:
isRunningin interfaceStandardizerActionRunner- Returns:
- true if the background thread runs false otherwise
-
addPropertyChangeListener
Description copied from interface:StandardizerActionRunnerAdds aPropertyChangeListenerthat will receive all thePropertyChangeEventfired by this class- Specified by:
addPropertyChangeListenerin interfaceStandardizerActionRunner- Parameters:
changeListener- aPropertyChangeListenerinstance
-
addPropertyChangeListener
Description copied from interface:StandardizerActionRunnerAdds aPropertyChangeListenerthat will receive thePropertyChangeEventfired when the property with the given name is changed- Specified by:
addPropertyChangeListenerin interfaceStandardizerActionRunner- Parameters:
propertyName- the name of the property to be listenedlistener- aPropertyChangeListenerinstance
-
standardizeAndWait
Description copied from interface:StandardizerActionRunnerExecutes 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:
standardizeAndWaitin 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:StandardizerActionRunnerSets the configuration of the runner- Specified by:
setConfigurationin 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:StandardizerActionRunnerGets the configuration of the runner- Specified by:
getConfigurationin interfaceStandardizerActionRunner- Returns:
- the configuration of the runner
-
getAppliedActions
Description copied from interface:StandardizerActionRunnerGets the list of actions applied in the configuration at the last execution- Specified by:
getAppliedActionsin interfaceStandardizerActionRunner- Returns:
- the list of applied actions at the last execution
-
setTargetGroup
Description copied from interface:StandardizerActionRunnerSets the target group of standardizer action of the runner- Specified by:
setTargetGroupin interfaceStandardizerActionRunner- Parameters:
groupName- the name of the group of standardizer actions
-
setTargetGroups
Description copied from interface:StandardizerActionRunnerSets the target groups of standardizer action of the runner- Specified by:
setTargetGroupsin 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:
clonein classObject- Throws:
CloneNotSupportedException
-
setLicenseEnvironment
Description copied from interface:StandardizerActionRunnerSets the license environment of the runner- Specified by:
setLicenseEnvironmentin interfaceStandardizerActionRunner- Parameters:
env- the license environment of the runner
-
getChanges
Description copied from interface:StandardizerActionRunnerGets 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:
getChangesin interfaceStandardizerActionRunner- Returns:
- the list of changes applied on the molecule
-
setIgnoreConfigurationErrors
public void setIgnoreConfigurationErrors(boolean ignore) Description copied from interface:StandardizerActionRunnerSets whether configuration errors should be ignored- Specified by:
setIgnoreConfigurationErrorsin interfaceStandardizerActionRunner- Parameters:
ignore- whether configuration errors should be ignored
-