@Override protected IStereoElement<IBond, IBond> create(IBond focus, List<IBond> carriers, int cfg) { return new DoubleBondStereochemistry(focus, carriers.toArray(new IBond[2]), cfg); } }
DoubleBondStereochemistry original = new DoubleBondStereochemistry(c1c2, new IBond[]{c1o3, c2o4}, Conformation.OPPOSITE); IDoubleBondStereochemistry mapped = original.map(Collections.EMPTY_MAP, mapping); is(not(sameInstance(original.getStereoBond())))); Assert.assertThat("mapped chiral atom was not the clone", mapped.getStereoBond(), is(sameInstance(c1c2clone))); IBond[] originalBonds = original.getBonds(); IBond[] mappedBonds = mapped.getBonds(); Assert.assertThat("second mapped bond was not the clone", mappedBonds[1], is(sameInstance(c2o4clone))); Assert.assertThat("stereo was not mapped", mapped.getStereo(), is(original.getStereo()));
@Test public void contains() throws Exception { IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance(); IAtom c1 = builder.newInstance(IAtom.class, "C"); IAtom c2 = builder.newInstance(IAtom.class, "C"); IAtom o3 = builder.newInstance(IAtom.class, "O"); IAtom o4 = builder.newInstance(IAtom.class, "O"); IBond c1c2 = builder.newInstance(IBond.class, c1, c2, Order.DOUBLE); IBond c1o3 = builder.newInstance(IBond.class, c1, o3, Order.SINGLE); IBond c2o4 = builder.newInstance(IBond.class, c2, o4, Order.SINGLE); // new stereo element DoubleBondStereochemistry element = new DoubleBondStereochemistry(c1c2, new IBond[]{c1o3, c2o4}, Conformation.OPPOSITE); assertTrue(element.contains(c1)); assertTrue(element.contains(c2)); assertTrue(element.contains(o3)); assertTrue(element.contains(o4)); assertFalse(element.contains(builder.newInstance(IAtom.class))); assertFalse(element.contains(null)); }
@Test public void testBuilder() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); stereo.setBuilder(DefaultChemObjectBuilder.getInstance()); Assert.assertEquals(DefaultChemObjectBuilder.getInstance(), stereo.getBuilder()); }
@Test public void testGetBonds() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); Assert.assertNotNull(stereo); for (int i = 0; i < ligands.length; i++) { Assert.assertEquals(ligands[i], stereo.getBonds()[i]); } }
@Test public void testGetStereo() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); Assert.assertNotNull(stereo); Assert.assertEquals(Conformation.OPPOSITE, stereo.getStereo()); }
@Test public void testGetStereoBond() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); Assert.assertNotNull(stereo); Assert.assertEquals(molecule.getBond(1), stereo.getStereoBond()); }
this.addStereoElement(se); } else if (se instanceof DoubleBondStereochemistry && !((DoubleBondStereochemistry) se).getStereoBond().getFlag(CDKConstants.VISITED)) { this.addStereoElement(se); } else if (se instanceof ExtendedTetrahedral &&
this.addStereoElement(se); } else if (se instanceof DoubleBondStereochemistry && !((DoubleBondStereochemistry) se).getStereoBond().getFlag(CDKConstants.VISITED)) { this.addStereoElement(se); } else if (se instanceof ExtendedTetrahedral &&
@Override protected IStereoElement<IBond, IBond> create(IBond focus, List<IBond> carriers, int cfg) { return new DoubleBondStereochemistry(focus, carriers.toArray(new IBond[2]), cfg); } }
this.addStereoElement(se); } else if (se instanceof DoubleBondStereochemistry && !((DoubleBondStereochemistry) se).getStereoBond().getFlag(CDKConstants.VISITED)) { this.addStereoElement(se); } else if (se instanceof ExtendedTetrahedral &&
@Test public void testToString() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); String stringRepr = stereo.toString(); Assert.assertNotSame(0, stringRepr.length()); assertFalse(stringRepr.contains("\n")); } }
this.addStereoElement(se); } else if (se instanceof DoubleBondStereochemistry && !((DoubleBondStereochemistry) se).getStereoBond().getFlag(CDKConstants.VISITED)) { this.addStereoElement(se); } else if (se instanceof ExtendedTetrahedral &&
@Test public void testConstructor() { DoubleBondStereochemistry stereo = new DoubleBondStereochemistry(molecule.getBond(1), ligands, Conformation.OPPOSITE); Assert.assertNotNull(stereo); }
boolean flipped = begBonds.contains(firstCarrier) != endBonds.contains(secondCarrier); int cfg = flipped ? se.getConfigOrder() ^ 0x3 : se.getConfigOrder(); ring.addStereoElement(new DoubleBondStereochemistry(stereoBond, new IBond[]{begBonds.get(0), endBonds.get(0)}, cfg));
boolean flipped = begBonds.contains(firstCarrier) != endBonds.contains(secondCarrier); int cfg = flipped ? se.getConfigOrder() ^ 0x3 : se.getConfigOrder(); ring.addStereoElement(new DoubleBondStereochemistry(stereoBond, new IBond[]{begBonds.get(0), endBonds.get(0)}, cfg));
IBond cpyRight = !Objects.equals(yNew, y) ? org.getBond(v, yNew) : orgRight; elements.add(new DoubleBondStereochemistry(orgStereo, new IBond[]{cpyLeft, cpyRight}, conformation));
Conformation conformation = leftBond.direction(left) == rightBond.direction(right) ? Conformation.TOGETHER : Conformation.OPPOSITE; fullQuery.addStereoElement(new DoubleBondStereochemistry(bond, new IBond[]{leftBond, rightBond}, conformation));
IBond cpyRight = yNew != y ? org.getBond(v, yNew) : orgRight; elements.add(new DoubleBondStereochemistry(orgStereo, new IBond[]{cpyLeft, cpyRight}, conformation));
@Test public void testSetStereoElements_List() { IAtomContainer container = (IAtomContainer) newChemObject(); IAtom atom = container.getBuilder().newAtom(); IBond bond = container.getBuilder().newBond(); IAtom a1 = container.getBuilder().newAtom(); IAtom a2 = container.getBuilder().newAtom(); IAtom a3 = container.getBuilder().newAtom(); IAtom a4 = container.getBuilder().newAtom(); IBond b1 = container.getBuilder().newBond(); IBond b2 = container.getBuilder().newBond(); Assert.assertThat("empty container had stereo elements", container.stereoElements().iterator().hasNext(), is(false)); List<IStereoElement> dbElements = new ArrayList<IStereoElement>(); dbElements.add(new DoubleBondStereochemistry(bond, new IBond[]{b1, b2}, IDoubleBondStereochemistry.Conformation.TOGETHER)); container.setStereoElements(dbElements); Iterator<IStereoElement> first = container.stereoElements().iterator(); Assert.assertThat("container did not have stereo elements", first.hasNext(), is(true)); Assert.assertThat("expected element to equal set element (double bond)", first.next(), is(dbElements.get(0))); Assert.assertThat("container had more then one stereo element", first.hasNext(), is(false)); List<IStereoElement> tetrahedralElements = new ArrayList<IStereoElement>(); tetrahedralElements.add(new TetrahedralChirality(atom, new IAtom[]{a1, a2, a3, a4}, ITetrahedralChirality.Stereo.CLOCKWISE)); container.setStereoElements(tetrahedralElements); Iterator<IStereoElement> second = container.stereoElements().iterator(); Assert.assertThat("container did not have stereo elements", second.hasNext(), is(true)); Assert.assertThat("expected element to equal set element (tetrahedral)", second.next(), is(tetrahedralElements.get(0))); Assert.assertThat("container had more then one stereo element", second.hasNext(), is(false)); }