private int countAttachedBonds(List<IBond> connectedBonds, IAtom atom, IBond.Order order, String symbol) {
        // count the number of double bonded oxygens
        int neighborcount = connectedBonds.size();
        int doubleBondedAtoms = 0;
        for (int i = neighborcount - 1; i >= 0; i--) {
            IBond bond = connectedBonds.get(i);
            if (bond.getOrder() == order) {
                if (bond.getAtomCount() == 2) {
                    if (symbol != null) {
                        // if other atom is of the given element (by its symbol)
                        if (bond.getOther(atom).getSymbol().equals(symbol)) {
                            doubleBondedAtoms++;
                        }
                    } else {
                        doubleBondedAtoms++;
                    }
                }
            }
        }
        return doubleBondedAtoms;
    }
private int countAttachedBonds ( List < IBond > connectedBonds , IAtom atom , IBond . Order order , String symbol ) { int neighborcount = connectedBonds . size ( ) ; int doubleBondedAtoms = 0 ; for ( int i = neighborcount - 1 ; i >= 0 ; i -- ) { IBond bond = connectedBonds . get ( i ) ; if ( bond . getOrder ( ) == order ) { if ( bond . getAtomCount ( ) == 2 ) { if ( symbol != null ) { if ( bond . getOther ( atom ) . getSymbol ( ) . equals ( symbol ) ) { doubleBondedAtoms ++ ; } } else { doubleBondedAtoms ++ ; } } } } return doubleBondedAtoms ; }
Count the number of doubly bonded atoms.

@param connectedBonds bonds connected to the atom
@param atom the atom being looked at
@param order the desired bond order of the attached bonds
@param symbol If not null, then it only counts the double bonded atoms which
match the given symbol.
@return the number of doubly bonded atoms