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 ; }
Count the number of doubly bonded atoms .