public abstract class AbstractStructureChecker extends Object implements StructureChecker, chemaxon.license.Licensable, Cloneable, PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
protected StructureCheckerErrorType |
errorType
The error type of the current checker.
|
protected PropertyChangeSupport |
propertyChangeSupport
property change support object bound to this
|
PROPERTY_KEY_VALID
Constructor and Description |
---|
AbstractStructureChecker(StructureCheckerErrorType errorType)
Constructor to create a Structure checker instance with the given errorType
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property.
|
StructureCheckerResult |
check(Molecule molecule)
Detects a specific error in the molecule.
|
protected abstract StructureCheckerResult |
check1(Molecule molecule)
This method contains the current checking mechanism.
|
AbstractStructureChecker |
clone() |
StructureChecker |
cloneItem()
Returns a clone of this StructureChecker instance
|
protected void |
convertResult(Molecule originalMolecule,
Molecule expandedMolecule,
StructureCheckerResult result,
Map<MolAtom,MolAtom> atomMap,
Map<MolBond,MolBond> bondMap)
Handles the mapping of a cloned and expanded molecule result to the original molecule.
|
boolean |
equals(Object obj) |
protected Molecule |
expandMolecule(Molecule molecule,
Map<MolAtom,MolAtom> atomMap,
Map<MolBond,MolBond> bondMap)
Returns the original molecule if no groups to expand,
or the clone of the original molecule with expanded groups.
|
String |
getDescription() |
StructureCheckerDescriptor |
getDescriptor()
Returns a
StructureCheckerDescriptor instance which represents the user interface
related informations of the checker |
String |
getEditorClassName() |
String |
getErrorCode()
Returns the
String represented error code of the checker (this error code
should be used for external implementation support instead of StructureChecker.getErrorType() ) |
protected String |
getErrorDescription(int errorCount)
Generate the error description depends on erroCount
|
StructureCheckerErrorType |
getErrorType() |
String |
getHelpText()
Gets the help text of the checker
|
Icon |
getIcon()
Gets the
Icon of the current checker |
String |
getLocalMenuName()
Gets the local menu name of the checker
|
String |
getName()
Gets the name of the checker
|
int |
hashCode() |
boolean |
isAvailable()
Returns true if the checker is available, and can be used
|
boolean |
isLicensed() |
boolean |
isValid()
Returns true if the checker's configuration is valid, false otherwise
|
void |
propertyChange(PropertyChangeEvent evt) |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property.
|
void |
setDescription(String description)
Sets the description of the checker
|
void |
setHelpText(String helpText)
Sets the detailed help of the checker which will shown in the tooltip on the GUI
|
void |
setIcon(Icon icon)
Sets the icon of the checker
|
void |
setLicenseEnvironment(String env) |
void |
setLocalMenuName(String localMenuName)
Set the local menu name of the checker
|
void |
setMoreErrorMessage(String moreErrorMessage)
Sets the message which will given in the result if two or more error found
|
void |
setName(String name)
Sets the name of the checker
|
void |
setNoErrorMessage(String noErrorMessage)
Sets the message which will given in the result if no error found
|
void |
setOneErrorMessage(String oneErrorMessage)
Sets the message which will given in the result if one error found
|
String |
toString() |
protected final StructureCheckerErrorType errorType
protected PropertyChangeSupport propertyChangeSupport
public AbstractStructureChecker(StructureCheckerErrorType errorType)
errorType
- element of StructureCheckerErrorType
public String getName()
StructureChecker
getName
in interface StructureChecker
public void setName(String name)
StructureChecker
setName
in interface StructureChecker
name
- the human readable name of the checkerpublic void setNoErrorMessage(String noErrorMessage)
StructureChecker
setNoErrorMessage
in interface StructureChecker
noErrorMessage
- the error message if no error foundpublic void setOneErrorMessage(String oneErrorMessage)
StructureChecker
setOneErrorMessage
in interface StructureChecker
oneErrorMessage
- the error message if one error foundpublic void setMoreErrorMessage(String moreErrorMessage)
StructureChecker
setMoreErrorMessage
in interface StructureChecker
moreErrorMessage
- the error message if two or more error foundprotected String getErrorDescription(int errorCount)
errorCount
- number of errors foundpublic String getLocalMenuName()
StructureChecker
getLocalMenuName
in interface StructureChecker
public void setLocalMenuName(String localMenuName)
StructureChecker
setLocalMenuName
in interface StructureChecker
localMenuName
- a String
to be shown in the local menupublic String getHelpText()
StructureChecker
getHelpText
in interface StructureChecker
public void setHelpText(String helpText)
StructureChecker
setHelpText
in interface StructureChecker
helpText
- a String
to be shown in the tooltippublic Icon getIcon()
StructureChecker
Icon
of the current checkergetIcon
in interface StructureChecker
Icon
of the current checkerpublic void setIcon(Icon icon)
StructureChecker
setIcon
in interface StructureChecker
icon
- is an instance of Icon
public final StructureCheckerResult check(Molecule molecule) throws NullPointerException, chemaxon.license.LicenseException
StructureChecker
check
in interface StructureChecker
molecule
- a Molecule
instance have to be checkedStructureCheckerResult
(which contains all data needed
to fix the problem) if the molecule contains the examined error, null
otherwiseNullPointerException
- if molecule is nullchemaxon.license.LicenseException
protected abstract StructureCheckerResult check1(Molecule molecule)
molecule
- the Molecule
instance to be checked for problemsStructureCheckerResult
which represents the problem or null
if no problem foundprotected Molecule expandMolecule(Molecule molecule, Map<MolAtom,MolAtom> atomMap, Map<MolBond,MolBond> bondMap)
molecule
- the molecule to checkprotected void convertResult(Molecule originalMolecule, Molecule expandedMolecule, StructureCheckerResult result, Map<MolAtom,MolAtom> atomMap, Map<MolBond,MolBond> bondMap)
originalMolecule
- the original moleculeexpandedMolecule
- the cloned then expanded moleculeresult
- the structure checker result on cloned moleculeatomMap
- the mapping of cloned molecule and original molecule atomsbondMap
- the mapping of cloned molecule and original molecule bondspublic boolean isLicensed()
isLicensed
in interface chemaxon.license.Licensable
public void setLicenseEnvironment(String env)
setLicenseEnvironment
in interface chemaxon.license.Licensable
public StructureCheckerErrorType getErrorType()
getErrorType
in interface StructureChecker
public String getErrorCode()
StructureChecker
String
represented error code of the checker (this error code
should be used for external implementation support instead of StructureChecker.getErrorType()
)getErrorCode
in interface StructureChecker
String
represented error code of the checker (this error code
should be used for external implementation support instead of StructureChecker.getErrorType()
)public String getEditorClassName()
getEditorClassName
in interface StructureChecker
public String getDescription()
getDescription
in interface StructureChecker
public boolean isValid()
StructureChecker
isValid
in interface StructureChecker
public boolean isAvailable()
StructureChecker
isAvailable
in interface StructureChecker
public StructureChecker cloneItem()
StructureChecker
cloneItem
in interface StructureChecker
public AbstractStructureChecker clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void setDescription(String description)
StructureChecker
setDescription
in interface StructureChecker
description
- the description to setpublic void addPropertyChangeListener(PropertyChangeListener listener)
StructureChecker
listener
is null, no exception is thrown and no action
is taken.addPropertyChangeListener
in interface StructureChecker
listener
- The PropertyChangeListener to be addedPropertyChangeSupport.addPropertyChangeListener(PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
StructureChecker
listener
was added more than once to the same event
source, it will be notified one less time after being removed.
If listener
is null, or was never added, no exception is
thrown and no action is taken.removePropertyChangeListener
in interface StructureChecker
listener
- The PropertyChangeListener to be removedPropertyChangeSupport.removePropertyChangeListener(PropertyChangeListener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
StructureChecker
propertyName
or listener
is null, no
exception is thrown and no action is taken.addPropertyChangeListener
in interface StructureChecker
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be addedPropertyChangeSupport.addPropertyChangeListener(String, PropertyChangeListener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
StructureChecker
listener
was added more than once to the same event
source for the specified property, it will be notified one less time
after being removed.
If propertyName
is null, no exception is thrown and no
action is taken.
If listener
is null, or was never added for the specified
property, no exception is thrown and no action is taken.removePropertyChangeListener
in interface StructureChecker
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removedPropertyChangeSupport.removePropertyChangeListener(String, PropertyChangeListener)
public StructureCheckerDescriptor getDescriptor()
StructureChecker
StructureCheckerDescriptor
instance which represents the user interface
related informations of the checkergetDescriptor
in interface StructureChecker
StructureCheckerDescriptor
instance which represents the user interface
related informations of the checkerpublic void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener