private void setupConnectionTable ( IAtomContainer atomContainer ) { int atomCount = atomContainer . getAtomCount ( ) ; connectionTable = new int [ atomCount ] [ ] ; if ( ! ignoreBondOrders ) { bondOrders = new int [ atomCount ] [ ] ; } for ( int atomIndex = 0 ; atomIndex < atomCount ; atomIndex ++ ) { IAtom atom = atomContainer . getAtom ( atomIndex ) ; List < IAtom > connectedAtoms = atomContainer . getConnectedAtomsList ( atom ) ; int numConnAtoms = connectedAtoms . size ( ) ; connectionTable [ atomIndex ] = new int [ numConnAtoms ] ; if ( ! ignoreBondOrders ) { bondOrders [ atomIndex ] = new int [ numConnAtoms ] ; } int i = 0 ; for ( IAtom connected : connectedAtoms ) { int index = atomContainer . indexOf ( connected ) ; connectionTable [ atomIndex ] [ i ] = index ; if ( ! ignoreBondOrders ) { IBond bond = atomContainer . getBond ( atom , connected ) ; boolean isArom = bond . getFlag ( CDKConstants . ISAROMATIC ) ; int orderNumber = ( isArom ) ? 5 : bond . getOrder ( ) . numeric ( ) ; bondOrders [ atomIndex ] [ i ] = orderNumber ; // TODO if ( orderNumber > maxBondOrder ) { maxBondOrder = orderNumber ; } } i ++ ; } } }
Makes a lookup table for the connection between atoms to avoid looking through the bonds each time .