public static IAtomContainer project ( List < CDKRMap > rMapList , IAtomContainer graph , int key ) { IAtomContainer atomContainer = graph . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; Map < IAtom , IAtom > table = new HashMap < IAtom , IAtom > ( ) ; IAtom atom1 ; IAtom atom2 ; IAtom atom ; IBond bond ; for ( Iterator < CDKRMap > i = rMapList . iterator ( ) ; i . hasNext ( ) ; ) { CDKRMap rMap = i . next ( ) ; if ( key == CDKMCS . ID1 ) { bond = graph . getBond ( rMap . getId1 ( ) ) ; } else { bond = graph . getBond ( rMap . getId2 ( ) ) ; } atom = bond . getBegin ( ) ; atom1 = table . get ( atom ) ; if ( atom1 == null ) { try { atom1 = ( IAtom ) atom . clone ( ) ; } catch ( CloneNotSupportedException e ) { e . printStackTrace ( ) ; } atomContainer . addAtom ( atom1 ) ; table . put ( atom , atom1 ) ; } atom = bond . getEnd ( ) ; atom2 = table . get ( atom ) ; if ( atom2 == null ) { try { atom2 = ( IAtom ) atom . clone ( ) ; } catch ( CloneNotSupportedException e ) { e . printStackTrace ( ) ; } atomContainer . addAtom ( atom2 ) ; table . put ( atom , atom2 ) ; } IBond newBond = graph . getBuilder ( ) . newInstance ( IBond . class , atom1 , atom2 , bond . getOrder ( ) ) ; newBond . setFlag ( CDKConstants . ISAROMATIC , bond . getFlag ( CDKConstants . ISAROMATIC ) ) ; atomContainer . addBond ( newBond ) ; } return atomContainer ; }
Projects atom list of CDKRMap on atom molecule .