private void adjust ( ExtendedCisTrans elem ) { IBond middle = elem . getFocus ( ) ; IAtom [ ] ends = ExtendedCisTrans . findTerminalAtoms ( container , middle ) ; IBond [ ] bonds = elem . getCarriers ( ) . toArray ( new IBond [ 2 ] ) ; IAtom left = ends [ 0 ] ; IAtom right = ends [ 1 ] ; int p = parity ( elem ) ; int q = parity ( getAtoms ( left , bonds [ 0 ] . getOther ( left ) , right ) ) * parity ( getAtoms ( right , bonds [ 1 ] . getOther ( right ) , left ) ) ; // configuration is unspecified? then we add an unspecified bond. // note: IDoubleBondStereochemistry doesn't indicate this yet if ( p == 0 ) { for ( IBond bond : container . getConnectedBondsList ( left ) ) bond . setStereo ( IBond . Stereo . NONE ) ; for ( IBond bond : container . getConnectedBondsList ( right ) ) bond . setStereo ( IBond . Stereo . NONE ) ; bonds [ 0 ] . setStereo ( IBond . Stereo . UP_OR_DOWN ) ; return ; } // configuration is already correct if ( p == q ) return ; Arrays . fill ( visited , false ) ; visited [ atomToIndex . get ( left ) ] = true ; if ( ringSearch . cyclic ( atomToIndex . get ( middle . getBegin ( ) ) , atomToIndex . get ( middle . getEnd ( ) ) ) ) { return ; } for ( int w : graph [ atomToIndex . get ( right ) ] ) { if ( ! visited [ w ] ) reflect ( w , middle ) ; } }
Adjust the configuration of the cumulated double bonds to be either Cis or Trans .