private static void addExtendedCisTransConfig(ExtendedCisTrans ect, GraphBuilder gb, Map<IAtom, Integer> indices, IAtomContainer container) { IAtom[] ends = ExtendedCisTrans.findTerminalAtoms(container, ect.getFocus()); IBond[] carriers = ect.getCarriers().toArray(new IBond[2]); if (ends != null) { Configuration.DoubleBond config; if (ect.getConfigOrder() == IStereoElement.TOGETHER) config = Configuration.DoubleBond.TOGETHER; else if (ect.getConfigOrder() == IStereoElement.OPPOSITE) config = Configuration.DoubleBond.OPPOSITE; else config = Configuration.DoubleBond.UNSPECIFIED; gb.extendedGeometric(indices.get(ends[0]), indices.get(ends[1])) .configure(indices.get(carriers[0].getOther(ends[0])), indices.get(carriers[1].getOther(ends[1])), config); } } }
@Test public void extendedExtendedCis3() throws Exception { IAtomContainer mol = load("C/C=C=C=C\\C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.TOGETHER)); assertThat(ect.getFocus(), is(mol.getBond(2))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(4))); } } }
@Test public void extendedExtendedTrans3() throws Exception { IAtomContainer mol = load("C/C=C=C=C/C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.OPPOSITE)); assertThat(ect.getFocus(), is(mol.getBond(2))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(4))); } } }
@Test public void extendedExtendedCis5() throws Exception { IAtomContainer mol = load("C/C=C=C=C=C=C\\C"); for (IStereoElement se : mol.stereoElements()) { if (se instanceof ExtendedCisTrans) { ExtendedCisTrans ect = (ExtendedCisTrans) se; assertThat(ect.getConfigOrder(), is(IStereoElement.TOGETHER)); assertThat(ect.getFocus(), is(mol.getBond(3))); assertThat(ect.getCarriers().get(0), is(mol.getBond(0))); assertThat(ect.getCarriers().get(1), is(mol.getBond(6))); } } }
IBond[] bonds = elem.getCarriers().toArray(new IBond[2]);
IBond[] bonds = elem.getCarriers().toArray(new IBond[2]);
IBond orgLeft = db.getCarriers().get(0); IBond orgRight = db.getCarriers().get(1);