chemaxon.checkers
Class ComponentChecker<E>

java.lang.Object
  extended by chemaxon.checkers.AbstractStructureChecker
      extended by chemaxon.checkers.ComponentChecker<E>
Type Parameters:
E - is the type of the component (for example: MolAtom, MolBond, etc...)
All Implemented Interfaces:
StructureChecker, chemaxon.license.Licensable, java.beans.PropertyChangeListener, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
AtomChecker, BondChecker

public abstract class ComponentChecker<E>
extends AbstractStructureChecker

Descendants of the abstract ComponentChecker class implement detect problems related to disconnected components (fragments).

Since:
Marvin 5.3
Version:
5.7

Field Summary
 
Fields inherited from class chemaxon.checkers.AbstractStructureChecker
errorType, propertyChangeSupport
 
Fields inherited from interface chemaxon.checkers.StructureChecker
PROPERTY_KEY_VALID
 
Constructor Summary
ComponentChecker(StructureCheckerErrorType errorType)
          Constructor to create a Structure checker instance with the given errorType.
 
Method Summary
protected abstract  boolean check(Molecule molecule, E component)
          Checks if the component with index i has problem
protected  StructureCheckerResult check1(Molecule molecule)
          Iterates through the components and checks every component.
protected abstract  StructureCheckerResult createResult(Molecule molecule, java.util.List<E> componentList)
          Creates a StructureCheckerResult from a List containing the components.
protected abstract  E getComponent(Molecule molecule, int i)
          Gets the component from the molecule with index i.
protected abstract  int getComponentCount(Molecule molecule)
          Gets the number of the components in the molecule
protected  void initialize()
          Empty default implementation
 
Methods inherited from class chemaxon.checkers.AbstractStructureChecker
addPropertyChangeListener, addPropertyChangeListener, check, clone, cloneItem, convertResult, equals, expandMolecule, getDescription, getDescriptor, getEditorClassName, getErrorCode, getErrorDescription, getErrorType, getHelpText, getIcon, getLocalMenuName, getName, hashCode, isAvailable, isLicensed, isValid, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setDescription, setHelpText, setIcon, setLicenseEnvironment, setLocalMenuName, setMoreErrorMessage, setName, setNoErrorMessage, setOneErrorMessage, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentChecker

public ComponentChecker(StructureCheckerErrorType errorType)
Constructor to create a Structure checker instance with the given errorType.

Parameters:
errorType - element of StructureCheckerErrorType
Method Detail

getComponentCount

protected abstract int getComponentCount(Molecule molecule)
Gets the number of the components in the molecule

Parameters:
molecule - the molecule to check
Returns:
the number of the components in the molecule

getComponent

protected abstract E getComponent(Molecule molecule,
                                  int i)
Gets the component from the molecule with index i.

Parameters:
molecule - the molecule to check
i - the index of the component
Returns:
the component

initialize

protected void initialize()
Empty default implementation


check1

protected StructureCheckerResult check1(Molecule molecule)
Iterates through the components and checks every component. If a component has error it is added to a List. After the iteration if no problem occurred the result is null otherwise the method creates a StructureCheckerResult containing the atoms and bonds of the problematic components.

Specified by:
check1 in class AbstractStructureChecker
Parameters:
molecule - the Molecule instance to be checked for problems
Returns:
a StructureCheckerResult which contains all the indices of the problematic components

createResult

protected abstract StructureCheckerResult createResult(Molecule molecule,
                                                       java.util.List<E> componentList)
Creates a StructureCheckerResult from a List containing the components.

Parameters:
molecule - is a Molecule instance
componentList - is an instance of List containing the problematic components
Returns:
a StructureCheckerResult containing all problematic component indices

check

protected abstract boolean check(Molecule molecule,
                                 E component)
Checks if the component with index i has problem

Parameters:
molecule - is a Molecule instance
component - the current component to check
Returns:
true if the component has problem, false otherwise