chemaxon.checkers.runner
Class BasicCheckerRunner

java.lang.Object
  extended by chemaxon.checkers.runner.BasicCheckerRunner
All Implemented Interfaces:
CheckerRunner
Direct Known Subclasses:
AdvancedCheckerRunner, SketchCheckerRunner

public class BasicCheckerRunner
extends java.lang.Object
implements CheckerRunner

This is the default basic implementation of CheckerRunner interface/

Since:
Marvin 5.7
Version:
5.9
Author:
Attila Szabo

Field Summary
protected  java.lang.Thread backgroundThread
           
protected  Molecule molecule
          The Molecule instance to check
 
Constructor Summary
BasicCheckerRunner(ConfigurationReader configurationReader)
          Initiate a BasicCheckerRunner instance which will can execute StructureChecker instances read from configurationReader
BasicCheckerRunner(ConfigurationReader configurationReader, chemaxon.fixers.StructureFixerFactory fixerFactory)
          Initiate a BasicCheckerRunner instance which will can execute StructureChecker instances read from configurationReader
BasicCheckerRunner(java.util.List<StructureChecker> checkerList)
          Initiate a BasicCheckerRunner instance with specified StructureChecker list.
 
Method Summary
 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
 void check()
          Invoke a background thread which will run all checkers on the given molecule
 java.util.List<StructureCheckerResult> checkAndWait()
          Execute all the checker instances on the given molecule and return a List of StructureCheckerResult which contains all the identified problems
protected  void convertResult(StructureCheckerResult result)
          This method provides the possibility to convert back the affected properties of the result if there was any convert in the molecule structure before check.
 boolean fix()
          Runs all StructureChecker on the given molecule and after that fixes all identified problems with the first StructureFixer which is associated with the current problem.
 boolean fix(StructureCheckerResult result)
          Fixes the problem identified by result with the first StructureFixer which is associated with the StructureCheckerErrorType of the result.
protected  java.beans.PropertyChangeSupport getChangeSupport()
          Returns the changeSupport
 java.util.List<StructureChecker> getCheckerConfiguration()
          Gets the list of available checkers
protected  java.util.List<StructureChecker> getCheckerList()
          Returns the checkerList
 int getCurrent()
           
 java.lang.String getCurrentCheckerName()
           
 java.util.List<StructureFixer> getFixers(StructureCheckerResult result)
          Returns all the StructureFixer instances which associated with the StructureCheckerErrorType of the result
protected  int getIndex()
          Returns the index
protected  Molecule getMolecule()
          Returns the molecule
 int getProgessLength()
           
 java.util.List<StructureCheckerResult> getResultList()
           
protected  java.lang.Runnable getStrategy()
          Returns the strategy to use.
protected  boolean isCanceled()
          Returns the canceled
 boolean isChecking()
          This function identifies the state of the checker thread
protected  boolean isDoodle()
          Returns the isDoodle
protected  void setCanceled(boolean canceled)
          Sets the canceled
protected  void setChangeSupport(java.beans.PropertyChangeSupport changeSupport)
          Sets the changeSupport
protected  void setCheckerList(java.util.List<StructureChecker> checkerList)
          Sets the checkerList
 void setConfigurationReader(ConfigurationReader configurationReader)
          Sets a new configuration for the Runner.
protected  void setDoodle(boolean isDoodle)
          Sets the isDoodle
 void setIgnoreConfigurationErrors(boolean ignore)
          Sets whether configuration errors should be ignored on execution.
protected  void setIndex(int index)
          Sets the index
 void setMolecule(Molecule molecule)
          Sets the molecule to be checked by the checkers
protected  void setResultList(java.util.List<StructureCheckerResult> resultList)
          Sets the resultList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

molecule

protected Molecule molecule
The Molecule instance to check


backgroundThread

protected java.lang.Thread backgroundThread
Constructor Detail

BasicCheckerRunner

public BasicCheckerRunner(ConfigurationReader configurationReader)
Initiate a BasicCheckerRunner instance which will can execute StructureChecker instances read from configurationReader

Parameters:
configurationReader - a ConfigurationReader instance

BasicCheckerRunner

public BasicCheckerRunner(ConfigurationReader configurationReader,
                          chemaxon.fixers.StructureFixerFactory fixerFactory)
Initiate a BasicCheckerRunner instance which will can execute StructureChecker instances read from configurationReader

Parameters:
configurationReader - a ConfigurationReader instance
fixerFactory - the fixer factory

BasicCheckerRunner

public BasicCheckerRunner(java.util.List<StructureChecker> checkerList)
Initiate a BasicCheckerRunner instance with specified StructureChecker list.

Parameters:
checkerList - the checker list
Since:
5.9
Method Detail

setConfigurationReader

public void setConfigurationReader(ConfigurationReader configurationReader)
Description copied from interface: CheckerRunner
Sets a new configuration for the Runner.

Specified by:
setConfigurationReader in interface CheckerRunner
Parameters:
configurationReader - is the ConfigurationReader instance which provides the current configuraiton

fix

public boolean fix()
Description copied from interface: CheckerRunner
Runs all StructureChecker on the given molecule and after that fixes all identified problems with the first StructureFixer which is associated with the current problem.

Specified by:
fix in interface CheckerRunner
Returns:
true if the fix ended correctly false otherwise

fix

public boolean fix(StructureCheckerResult result)
Description copied from interface: CheckerRunner
Fixes the problem identified by result with the first StructureFixer which is associated with the StructureCheckerErrorType of the result.

Specified by:
fix in interface CheckerRunner
Parameters:
result - a StructureCheckerResult instance which identifies the problem
Returns:
true if the fix ended correctly false otherwise

getFixers

public java.util.List<StructureFixer> getFixers(StructureCheckerResult result)
Description copied from interface: CheckerRunner
Returns all the StructureFixer instances which associated with the StructureCheckerErrorType of the result

Specified by:
getFixers in interface CheckerRunner
Parameters:
result - a StructureCheckerResult instance which identifies the current problem
Returns:
a List of StructureFixer

setMolecule

public void setMolecule(Molecule molecule)
Description copied from interface: CheckerRunner
Sets the molecule to be checked by the checkers

Specified by:
setMolecule in interface CheckerRunner
Parameters:
molecule - a Molecule instance to be checked

check

public void check()
Description copied from interface: CheckerRunner
Invoke a background thread which will run all checkers on the given molecule

Specified by:
check in interface CheckerRunner

cancel

public void cancel()
Description copied from interface: CheckerRunner
Stops the background thread

Specified by:
cancel in interface CheckerRunner

getCurrent

public int getCurrent()
Specified by:
getCurrent in interface CheckerRunner
Returns:
the current progress percent

getCurrentCheckerName

public java.lang.String getCurrentCheckerName()
Specified by:
getCurrentCheckerName in interface CheckerRunner
Returns:
which StructureChecker instance run currently

getProgessLength

public int getProgessLength()
Specified by:
getProgessLength in interface CheckerRunner
Returns:
the length of the checking process

getResultList

public java.util.List<StructureCheckerResult> getResultList()
Specified by:
getResultList in interface CheckerRunner
Returns:
a List of StructureCheckerResult which contains all the dentified problem about the given molecule

isChecking

public boolean isChecking()
Description copied from interface: CheckerRunner
This function identifies the state of the checker thread

Specified by:
isChecking in interface CheckerRunner
Returns:
true if the background thread runs false otherwise

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener changeListener)
Description copied from interface: CheckerRunner
Adds a PropertyChangeListener that will receive all the PropertyChangeEvent fired by this class

Specified by:
addPropertyChangeListener in interface CheckerRunner
Parameters:
changeListener - a PropertyChangeListener instance

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Description copied from interface: CheckerRunner
Adds a PropertyChangeListener that will receive the PropertyChangeEvent fired when the property with the given name is changed

Specified by:
addPropertyChangeListener in interface CheckerRunner
Parameters:
propertyName - the name of the property to be listened
listener - a PropertyChangeListener instance

checkAndWait

public java.util.List<StructureCheckerResult> checkAndWait()
Description copied from interface: CheckerRunner
Execute all the checker instances on the given molecule and return a List of StructureCheckerResult which contains all the identified problems

Specified by:
checkAndWait in interface CheckerRunner
Returns:
a List of StructureCheckerResult which contains all the identified problem about the given molecule

convertResult

protected void convertResult(StructureCheckerResult result)
This method provides the possibility to convert back the affected properties of the result if there was any convert in the molecule structure before check. By default this implementation is empty and isn't needed to override!

Parameters:
result - the StructureCheckerResult instance

getStrategy

protected java.lang.Runnable getStrategy()
Returns the strategy to use.

Returns:
the strategy

setCanceled

protected void setCanceled(boolean canceled)
Sets the canceled

Parameters:
canceled - the canceled to set

isCanceled

protected boolean isCanceled()
Returns the canceled

Returns:
the canceled

setDoodle

protected void setDoodle(boolean isDoodle)
Sets the isDoodle

Parameters:
isDoodle - the isDoodle to set

isDoodle

protected boolean isDoodle()
Returns the isDoodle

Returns:
the isDoodle

setIndex

protected void setIndex(int index)
Sets the index

Parameters:
index - the index to set

getIndex

protected int getIndex()
Returns the index

Returns:
the index

setResultList

protected void setResultList(java.util.List<StructureCheckerResult> resultList)
Sets the resultList

Parameters:
resultList - the resultList to set

setCheckerList

protected void setCheckerList(java.util.List<StructureChecker> checkerList)
Sets the checkerList

Parameters:
checkerList - the checkerList to set

getCheckerList

protected java.util.List<StructureChecker> getCheckerList()
Returns the checkerList

Returns:
the checkerList

getMolecule

protected Molecule getMolecule()
Returns the molecule

Returns:
the molecule

setChangeSupport

protected void setChangeSupport(java.beans.PropertyChangeSupport changeSupport)
Sets the changeSupport

Parameters:
changeSupport - the changeSupport to set

getChangeSupport

protected java.beans.PropertyChangeSupport getChangeSupport()
Returns the changeSupport

Returns:
the changeSupport

getCheckerConfiguration

public java.util.List<StructureChecker> getCheckerConfiguration()
Description copied from interface: CheckerRunner
Gets the list of available checkers

Specified by:
getCheckerConfiguration in interface CheckerRunner
Returns:
the list of available checkers

setIgnoreConfigurationErrors

public void setIgnoreConfigurationErrors(boolean ignore)
Description copied from interface: CheckerRunner
Sets whether configuration errors should be ignored on execution.

Specified by:
setIgnoreConfigurationErrors in interface CheckerRunner
Parameters:
ignore - true if configuration errors should be ignored on execution