private IBond checkEdges ( IRing ring , IAtomContainer molecule ) { IRing r1 , r2 ; IRingSet ringSet = ring . getBuilder ( ) . newInstance ( IRingSet . class ) ; IBond bond ; int minMaxSize = Integer . MAX_VALUE ; int minMax = 0 ; logger . debug ( "Molecule: " + molecule ) ; Iterator < IBond > bonds = ring . bonds ( ) . iterator ( ) ; while ( bonds . hasNext ( ) ) { bond = ( IBond ) bonds . next ( ) ; molecule . removeElectronContainer ( bond ) ; r1 = getRing ( bond . getBegin ( ) , molecule ) ; r2 = getRing ( bond . getEnd ( ) , molecule ) ; logger . debug ( "checkEdges: " + bond ) ; if ( r1 . getAtomCount ( ) > r2 . getAtomCount ( ) ) { ringSet . addAtomContainer ( r1 ) ; } else { ringSet . addAtomContainer ( r2 ) ; } molecule . addBond ( bond ) ; } for ( int i = 0 ; i < ringSet . getAtomContainerCount ( ) ; i ++ ) { if ( ( ( IRing ) ringSet . getAtomContainer ( i ) ) . getBondCount ( ) < minMaxSize ) { minMaxSize = ( ( IRing ) ringSet . getAtomContainer ( i ) ) . getBondCount ( ) ; minMax = i ; } } return ( IBond ) ring . getElectronContainer ( minMax ) ; }
Selects an optimum edge for elimination in structures without N2 nodes .