Package chemaxon.checkers
Class AbstractStructureChecker
- java.lang.Object
-
- chemaxon.checkers.AbstractStructureChecker
-
- All Implemented Interfaces:
StructureChecker
,chemaxon.license.Licensable
,PropertyChangeListener
,Cloneable
,EventListener
- Direct Known Subclasses:
AbbreviatedGroupChecker
,AbsentChiralFlagChecker
,AbsoluteStereoConfigurationChecker
,AromaticityErrorChecker
,AtropisomerChecker
,AttachedDataChecker
,BondAngleChecker
,BondLengthChecker
,BracketsChecker
,ChiralFlagChecker
,ChiralFlagErrorChecker
,CircularRGroupReferenceChecker
,ComponentChecker
,CoordinationSystemErrorChecker
,CovalentCounterionChecker
,EmptyStructureChecker
,ExplicitHydrogenChecker
,ExternalStructureChecker
,EZDoubleBondChecker
,IncorrectTetrahedralStereoChecker
,MetalloceneErrorChecker
,MissingRGroupChecker
,MoleculeChargeChecker
,MultiComponentChecker
,MultipleStereocenterChecker
,NonStandardWedgeSchemeChecker
,NonStereoWedgeBondChecker
,OCRErrorChecker
,RatomChecker
,ReactionChecker
,RelativeStereoChecker
,RgroupAttachmentErrorChecker
,RgroupBridgeRatomChecker
,RingStrainErrorChecker
,SolventChecker
,StereoCareBoxChecker
,SubstructureChecker
,UnbalancedReactionChecker
,UnusedRGroupChecker
,ValenceErrorChecker
,WedgeErrorChecker
,WigglyBondChecker
,WigglyDoubleBondChecker
@PublicAPI public abstract class AbstractStructureChecker extends Object implements StructureChecker, chemaxon.license.Licensable, Cloneable, PropertyChangeListener
Abstract base class of all functions checking and repairing chemical structures.- Since:
- Marvin 5.3
-
-
Field Summary
Fields Modifier and Type Field Description protected StructureCheckerErrorType
errorType
The error type of the current checker.protected PropertyChangeSupport
propertyChangeSupport
property change support object bound to this-
Fields inherited from interface chemaxon.checkers.StructureChecker
PROPERTY_KEY_VALID
-
-
Constructor Summary
Constructors Constructor Description AbstractStructureChecker(StructureCheckerErrorType errorType)
Constructor to create a Structure checker instance with the given errorType
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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 instanceprotected 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 aStructureCheckerDescriptor
instance which represents the user interface related informations of the checkerString
getEditorClassName()
String
getErrorCode()
Returns theString
represented error code of the checker (this error code should be used for external implementation support instead ofStructureChecker.getErrorType()
)protected String
getErrorDescription(int errorCount)
Generate the error description depends on erroCountStructureCheckerErrorType
getErrorType()
String
getHelpText()
Gets the help text of the checkerIcon
getIcon()
Gets theIcon
of the current checkerString
getLocalMenuName()
Gets the local menu name of the checkerString
getName()
Gets the name of the checkerint
hashCode()
boolean
isAvailable()
Returns true if the checker is available, and can be usedboolean
isLicensed()
boolean
isValid()
Returns true if the checker's configuration is valid, false otherwisevoid
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 checkervoid
setHelpText(String helpText)
Sets the detailed help of the checker which will shown in the tooltip on the GUIvoid
setIcon(Icon icon)
Sets the icon of the checkervoid
setLicenseEnvironment(String env)
void
setLocalMenuName(String localMenuName)
Set the local menu name of the checkervoid
setMoreErrorMessage(String moreErrorMessage)
Sets the message which will given in the result if two or more error foundvoid
setName(String name)
Sets the name of the checkervoid
setNoErrorMessage(String noErrorMessage)
Sets the message which will given in the result if no error foundvoid
setOneErrorMessage(String oneErrorMessage)
Sets the message which will given in the result if one error foundString
toString()
-
-
-
Field Detail
-
errorType
protected final StructureCheckerErrorType errorType
The error type of the current checker. It is a value so can not assigned more than once
-
propertyChangeSupport
protected PropertyChangeSupport propertyChangeSupport
property change support object bound to this
-
-
Constructor Detail
-
AbstractStructureChecker
public AbstractStructureChecker(StructureCheckerErrorType errorType)
Constructor to create a Structure checker instance with the given errorType- Parameters:
errorType
- element ofStructureCheckerErrorType
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:StructureChecker
Gets the name of the checker- Specified by:
getName
in interfaceStructureChecker
- Returns:
- a human readable name
-
setName
public void setName(String name)
Description copied from interface:StructureChecker
Sets the name of the checker- Specified by:
setName
in interfaceStructureChecker
- Parameters:
name
- the human readable name of the checker
-
setNoErrorMessage
public void setNoErrorMessage(String noErrorMessage)
Description copied from interface:StructureChecker
Sets the message which will given in the result if no error found- Specified by:
setNoErrorMessage
in interfaceStructureChecker
- Parameters:
noErrorMessage
- the error message if no error found
-
setOneErrorMessage
public void setOneErrorMessage(String oneErrorMessage)
Description copied from interface:StructureChecker
Sets the message which will given in the result if one error found- Specified by:
setOneErrorMessage
in interfaceStructureChecker
- Parameters:
oneErrorMessage
- the error message if one error found
-
setMoreErrorMessage
public void setMoreErrorMessage(String moreErrorMessage)
Description copied from interface:StructureChecker
Sets the message which will given in the result if two or more error found- Specified by:
setMoreErrorMessage
in interfaceStructureChecker
- Parameters:
moreErrorMessage
- the error message if two or more error found
-
getErrorDescription
protected String getErrorDescription(int errorCount)
Generate the error description depends on erroCount- Parameters:
errorCount
- number of errors found- Returns:
- a human readable description about how many and which kind of errors found
-
getLocalMenuName
public String getLocalMenuName()
Description copied from interface:StructureChecker
Gets the local menu name of the checker- Specified by:
getLocalMenuName
in interfaceStructureChecker
- Returns:
- the name for the local menu
-
setLocalMenuName
public void setLocalMenuName(String localMenuName)
Description copied from interface:StructureChecker
Set the local menu name of the checker- Specified by:
setLocalMenuName
in interfaceStructureChecker
- Parameters:
localMenuName
- aString
to be shown in the local menu
-
getHelpText
public String getHelpText()
Description copied from interface:StructureChecker
Gets the help text of the checker- Specified by:
getHelpText
in interfaceStructureChecker
- Returns:
- the help text of the checker
-
setHelpText
public void setHelpText(String helpText)
Description copied from interface:StructureChecker
Sets the detailed help of the checker which will shown in the tooltip on the GUI- Specified by:
setHelpText
in interfaceStructureChecker
- Parameters:
helpText
- aString
to be shown in the tooltip
-
getIcon
public Icon getIcon()
Description copied from interface:StructureChecker
Gets theIcon
of the current checker- Specified by:
getIcon
in interfaceStructureChecker
- Returns:
- the
Icon
of the current checker
-
setIcon
public void setIcon(Icon icon)
Description copied from interface:StructureChecker
Sets the icon of the checker- Specified by:
setIcon
in interfaceStructureChecker
- Parameters:
icon
- is an instance ofIcon
-
check
public final StructureCheckerResult check(Molecule molecule) throws NullPointerException, chemaxon.license.LicenseException
Description copied from interface:StructureChecker
Detects a specific error in the molecule.- Specified by:
check
in interfaceStructureChecker
- Parameters:
molecule
- aMolecule
instance have to be checked- Returns:
- an instance of
StructureCheckerResult
(which contains all data needed to fix the problem) if the molecule contains the examined error,null
otherwise - Throws:
NullPointerException
- if molecule is nullchemaxon.license.LicenseException
-
check1
protected abstract StructureCheckerResult check1(Molecule molecule)
This method contains the current checking mechanism.- Parameters:
molecule
- theMolecule
instance to be checked for problems- Returns:
- a
StructureCheckerResult
which represents the problem or null if no problem found
-
expandMolecule
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.- Parameters:
molecule
- the molecule to check- Returns:
- the original molecule, or a clone with expanded sgroups
- Since:
- 5.9
-
convertResult
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.- Parameters:
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 bonds- Since:
- 5.9
-
isLicensed
public boolean isLicensed()
- Specified by:
isLicensed
in interfacechemaxon.license.Licensable
-
setLicenseEnvironment
public void setLicenseEnvironment(String env)
- Specified by:
setLicenseEnvironment
in interfacechemaxon.license.Licensable
-
getErrorType
public StructureCheckerErrorType getErrorType()
- Specified by:
getErrorType
in interfaceStructureChecker
- Returns:
- the error type of this checker
-
getErrorCode
public String getErrorCode()
Description copied from interface:StructureChecker
Returns theString
represented error code of the checker (this error code should be used for external implementation support instead ofStructureChecker.getErrorType()
)- Specified by:
getErrorCode
in interfaceStructureChecker
- Returns:
- the
String
represented error code of the checker (this error code should be used for external implementation support instead ofStructureChecker.getErrorType()
)
-
getEditorClassName
public String getEditorClassName()
- Specified by:
getEditorClassName
in interfaceStructureChecker
- Returns:
- the name of the editor class of the checker
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceStructureChecker
- Returns:
- the description
-
isValid
public boolean isValid()
Description copied from interface:StructureChecker
Returns true if the checker's configuration is valid, false otherwise- Specified by:
isValid
in interfaceStructureChecker
- Returns:
- true if the checker's configuration is valid, false otherwise
-
isAvailable
public boolean isAvailable()
Description copied from interface:StructureChecker
Returns true if the checker is available, and can be used- Specified by:
isAvailable
in interfaceStructureChecker
- Returns:
- true if the checker is available, and can be used
-
cloneItem
public StructureChecker cloneItem()
Description copied from interface:StructureChecker
Returns a clone of this StructureChecker instance- Specified by:
cloneItem
in interfaceStructureChecker
- Returns:
- a clone of this StructureChecker instance
-
clone
public AbstractStructureChecker clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
setDescription
public void setDescription(String description)
Description copied from interface:StructureChecker
Sets the description of the checker- Specified by:
setDescription
in interfaceStructureChecker
- Parameters:
description
- the description to set
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface:StructureChecker
Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. Iflistener
is null, no exception is thrown and no action is taken.- Specified by:
addPropertyChangeListener
in interfaceStructureChecker
- Parameters:
listener
- The PropertyChangeListener to be added- See Also:
PropertyChangeSupport.addPropertyChangeListener(PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface:StructureChecker
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. Iflistener
was added more than once to the same event source, it will be notified one less time after being removed. Iflistener
is null, or was never added, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceStructureChecker
- Parameters:
listener
- The PropertyChangeListener to be removed- See Also:
PropertyChangeSupport.removePropertyChangeListener(PropertyChangeListener)
-
addPropertyChangeListener
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Description copied from interface:StructureChecker
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property. IfpropertyName
orlistener
is null, no exception is thrown and no action is taken.- Specified by:
addPropertyChangeListener
in interfaceStructureChecker
- Parameters:
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be added- See Also:
PropertyChangeSupport.addPropertyChangeListener(String, PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
Description copied from interface:StructureChecker
Remove a PropertyChangeListener for a specific property. Iflistener
was added more than once to the same event source for the specified property, it will be notified one less time after being removed. IfpropertyName
is null, no exception is thrown and no action is taken. Iflistener
is null, or was never added for the specified property, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceStructureChecker
- Parameters:
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removed- See Also:
PropertyChangeSupport.removePropertyChangeListener(String, PropertyChangeListener)
-
getDescriptor
public StructureCheckerDescriptor getDescriptor()
Description copied from interface:StructureChecker
Returns aStructureCheckerDescriptor
instance which represents the user interface related informations of the checker- Specified by:
getDescriptor
in interfaceStructureChecker
- Returns:
- a
StructureCheckerDescriptor
instance which represents the user interface related informations of the checker
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
-