@PublicAPI public class BasicStandardizerRunner extends java.lang.Object implements StandardizerActionRunner
StandardizerActionRunner
interface.IllegalArgumentException
should be thrown during the standardization
procedure. Logger
, that can be collected by using
StandardizerLogger.getLogger()
method.Modifier and Type | Field and Description |
---|---|
protected java.lang.Thread |
backgroundThread |
protected Molecule |
molecule
The
Molecule instance to standardize |
Constructor and Description |
---|
BasicStandardizerRunner(StandardizerConfiguration configuration)
Initialize a
BasicStandardizerRunner instance with specified
StandardizerConfiguration . |
BasicStandardizerRunner(StandardizerConfigurationReader configurationReader)
Initialize a
BasicStandardizerRunner instance with the
StandardizerConfiguration read from the provided configuration
reader. |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
Adds a
PropertyChangeListener that will receive all the
PropertyChangeEvent fired by this class |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a
PropertyChangeListener that will receive the
PropertyChangeEvent fired when the property with the given name
is changed |
void |
cancel()
Stops the background thread
|
BasicStandardizerRunner |
clone() |
java.util.List<StandardizerAction> |
getAppliedActions()
Gets the list of actions applied in the configuration at the last
execution
|
java.util.List<Changes> |
getChanges()
Gets the list of changes applied on the molecule.
|
protected java.beans.PropertyChangeSupport |
getChangeSupport()
Returns the changeSupport
|
StandardizerConfiguration |
getConfiguration()
Gets the configuration of the runner
|
int |
getCurrent()
Gets the current progress percent
|
java.lang.String |
getCurrentActionName()
Gets which
StandardizerAction instance run currently |
protected int |
getIndex()
Returns the index of the actual action of the configuration
|
Molecule |
getMolecule()
Returns the target molecule
|
int |
getProgessLength()
Gets the length of the standardization process
|
protected java.lang.Runnable |
getStrategy()
Returns the strategy to use.
|
java.lang.String[] |
getTargetGroups()
Gets the target action groups of the standardizer
|
protected boolean |
isCanceled()
Returns whether the process is cancelled
|
boolean |
isRunning()
This function identifies the state of the standardizer thread
|
protected void |
setCanceled(boolean canceled)
Sets whether the process is cancelled
|
protected void |
setChangeSupport(java.beans.PropertyChangeSupport changeSupport)
Sets the changeSupport
|
void |
setConfiguration(StandardizerConfiguration configuration)
Sets the configuration of the runner
|
void |
setConfigurationReader(StandardizerConfigurationReader configurationReader)
Sets a new configuration for the runner.
|
void |
setIgnoreConfigurationErrors(boolean ignore)
Sets whether configuration errors should be ignored
|
protected void |
setIndex(int index)
Sets the index of the actual action of the configuration
|
void |
setLicenseEnvironment(java.lang.String env)
Sets the license environment of the runner
|
void |
setMolecule(Molecule molecule)
Sets the molecule to be standardized by the standardizer actions
|
void |
setTargetGroup(java.lang.String groupName)
Sets the target group of standardizer action of the runner
|
void |
setTargetGroups(java.lang.String... groupNames)
Sets the target groups of standardizer action of the runner
|
void |
standardize()
Invoke a background thread which will run all standardizer actions on the
given molecule
|
java.util.List<Changes> |
standardizeAndWait()
Executes all standardizer actions contained by the pre-set configuration
on the given molecule and returns the list of applied changes.
|
public BasicStandardizerRunner(StandardizerConfigurationReader configurationReader)
BasicStandardizerRunner
instance with the
StandardizerConfiguration
read from the provided configuration
reader.configurationReader
- a StandardizerConfigurationReader
instance, containing
the configuration of the standardization processpublic BasicStandardizerRunner(StandardizerConfiguration configuration)
BasicStandardizerRunner
instance with specified
StandardizerConfiguration
.configuration
- the configuration of the standardization procedurepublic void setConfigurationReader(StandardizerConfigurationReader configurationReader)
StandardizerActionRunner
setConfigurationReader
in interface StandardizerActionRunner
configurationReader
- is the StandardizerConfigurationReader
instance which
provides the current configurationpublic void setMolecule(Molecule molecule)
StandardizerActionRunner
setMolecule
in interface StandardizerActionRunner
molecule
- a Molecule
instance to be standardizedpublic void standardize() throws java.lang.IllegalArgumentException
StandardizerActionRunner
standardize
in interface StandardizerActionRunner
java.lang.IllegalArgumentException
- if the configuration or the molecule contains errorspublic void cancel()
StandardizerActionRunner
cancel
in interface StandardizerActionRunner
public int getCurrent()
StandardizerActionRunner
getCurrent
in interface StandardizerActionRunner
public java.lang.String getCurrentActionName()
StandardizerActionRunner
StandardizerAction
instance run currentlygetCurrentActionName
in interface StandardizerActionRunner
StandardizerAction
instance run currentlypublic int getProgessLength()
StandardizerActionRunner
getProgessLength
in interface StandardizerActionRunner
public boolean isRunning()
StandardizerActionRunner
isRunning
in interface StandardizerActionRunner
public void addPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
StandardizerActionRunner
PropertyChangeListener
that will receive all the
PropertyChangeEvent
fired by this classaddPropertyChangeListener
in interface StandardizerActionRunner
changeListener
- a PropertyChangeListener
instancepublic void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
StandardizerActionRunner
PropertyChangeListener
that will receive the
PropertyChangeEvent
fired when the property with the given name
is changedaddPropertyChangeListener
in interface StandardizerActionRunner
propertyName
- the name of the property to be listenedlistener
- a PropertyChangeListener
instancepublic java.util.List<Changes> standardizeAndWait() throws java.lang.IllegalArgumentException
StandardizerActionRunner
standardizeAndWait
in interface StandardizerActionRunner
java.lang.IllegalArgumentException
- if the configuration or the molecule contains errorsprotected java.lang.Runnable getStrategy()
protected void setCanceled(boolean canceled)
canceled
- whether the process should be cancelledprotected boolean isCanceled()
protected void setIndex(int index)
index
- the index of the actual action of the configurationprotected int getIndex()
public void setConfiguration(StandardizerConfiguration configuration)
StandardizerActionRunner
setConfiguration
in interface StandardizerActionRunner
configuration
- the configuration to be set to the runnerpublic Molecule getMolecule()
protected void setChangeSupport(java.beans.PropertyChangeSupport changeSupport)
changeSupport
- the changeSupport to be setprotected java.beans.PropertyChangeSupport getChangeSupport()
public StandardizerConfiguration getConfiguration()
StandardizerActionRunner
getConfiguration
in interface StandardizerActionRunner
public java.util.List<StandardizerAction> getAppliedActions()
StandardizerActionRunner
getAppliedActions
in interface StandardizerActionRunner
public void setTargetGroup(java.lang.String groupName)
StandardizerActionRunner
setTargetGroup
in interface StandardizerActionRunner
groupName
- the name of the group of standardizer actionspublic void setTargetGroups(java.lang.String... groupNames)
StandardizerActionRunner
setTargetGroups
in interface StandardizerActionRunner
groupNames
- the names of the groups of standardizer actionspublic java.lang.String[] getTargetGroups()
public BasicStandardizerRunner clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void setLicenseEnvironment(java.lang.String env)
StandardizerActionRunner
setLicenseEnvironment
in interface StandardizerActionRunner
env
- the license environment of the runnerpublic java.util.List<Changes> getChanges()
StandardizerActionRunner
getChanges
in interface StandardizerActionRunner
public void setIgnoreConfigurationErrors(boolean ignore)
StandardizerActionRunner
setIgnoreConfigurationErrors
in interface StandardizerActionRunner
ignore
- whether configuration errors should be ignored