class AtomHybridizationDescriptor extends AbstractAtomicDescriptor implements IAtomicDescriptor {

    @Override
    public DescriptorValue calculate(IAtom atom, IAtomContainer container) {
        try {
            matched = CDKAtomTypeMatcher.getInstance(atom.getBuilder()).findMatchingAtomType(container, atom);
        } catch (CDKException e) {
            return getDummyDescriptorValue(e);
        }
        if (matched == null) {
            int atnum = container.indexOf(atom);
            return getDummyDescriptorValue(new CDKException("The matched atom type was null (atom number " + atnum
                    + ") " + atom.getSymbol()));
        }
        Hybridization atomHybridization = matched.getHybridization();
        IntegerResult result = new IntegerResult(atomHybridization == null ? 0 : atomHybridization.ordinal());
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                getDescriptorNames());
    }

}