class AromaticBondsCountDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor {

    @Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        IAtomContainer ac;
        try {
            ac = (IAtomContainer) atomContainer.clone();
        } catch (CloneNotSupportedException e) {
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                    (int) Double.NaN), getDescriptorNames(), new CDKException("Error during clone"));
        }

        int aromaticBondsCount = 0;
        if (checkAromaticity) {
            try {
                AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(ac);
            } catch (CDKException e) {
                return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                        (int) Double.NaN), getDescriptorNames(), new CDKException("Error during atom type perception"));
            }
            try {
                Aromaticity.cdkLegacy().apply(ac);
            } catch (CDKException e) {
                return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                        (int) Double.NaN), getDescriptorNames(), new CDKException(
                        "Error during aromaticity detection: " + e.getMessage()));
            }
        }
        Iterator bonds = ac.bonds().iterator();
        while (bonds.hasNext()) {
            IBond bond = (IBond) bonds.next();
            if (bond.getFlag(CDKConstants.ISAROMATIC)) {
                aromaticBondsCount += 1;
            }
        }
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                aromaticBondsCount), getDescriptorNames());
    }

    public  AromaticBondsCountDescriptor();

}