private int getNearestBondtoAGivenAtom ( IAtomContainer mol , IAtom atom , IBond bond ) { int nearestBond = 0 ; double [ ] values ; double distance = 0 ; IAtom atom0 = bond . getBegin ( ) ; List < IBond > bondsAtLeft = mol . getConnectedBondsList ( atom0 ) ; int partial ; for ( int i = 0 ; i < bondsAtLeft . size ( ) ; i ++ ) { IBond curBond = bondsAtLeft . get ( i ) ; values = calculateDistanceBetweenAtomAndBond ( atom , curBond ) ; partial = mol . indexOf ( curBond ) ; if ( i == 0 ) { nearestBond = mol . indexOf ( curBond ) ; distance = values [ 0 ] ; } else { if ( values [ 0 ] < distance ) { nearestBond = partial ; } } } return nearestBond ; }
this method returns a bond bonded to this double bond