IBond currentBond = (IBond) bonds.get(0); for (int i = 0; i < ring.getBondCount(); i++) { currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); atomsToDraw.addElement(currentAtom);
IBond currentBond = (IBond) bonds.get(0); for (int i = 0; i < ring.getBondCount(); i++) { currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); atomsToDraw.addElement(currentAtom);
@Test public void testGetNextBond_IBond_IAtom() { IRing ring = (IRing) newChemObject(); IAtom c1 = ring.getBuilder().newInstance(IAtom.class, "C"); IAtom c2 = ring.getBuilder().newInstance(IAtom.class, "C"); IAtom c3 = ring.getBuilder().newInstance(IAtom.class, "C"); IBond b1 = ring.getBuilder().newInstance(IBond.class, c1, c2, IBond.Order.SINGLE); IBond b2 = ring.getBuilder().newInstance(IBond.class, c3, c2, IBond.Order.SINGLE); IBond b3 = ring.getBuilder().newInstance(IBond.class, c1, c3, IBond.Order.SINGLE); ring.addAtom(c1); ring.addAtom(c2); ring.addAtom(c3); ring.addBond(b1); ring.addBond(b2); ring.addBond(b3); Assert.assertEquals(b1, ring.getNextBond(b2, c2)); Assert.assertEquals(b1, ring.getNextBond(b3, c1)); Assert.assertEquals(b2, ring.getNextBond(b1, c2)); Assert.assertEquals(b2, ring.getNextBond(b3, c3)); Assert.assertEquals(b3, ring.getNextBond(b1, c1)); Assert.assertEquals(b3, ring.getNextBond(b2, c3)); }
currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); if (!sharedAtoms.contains(currentAtom)) {
currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); if (!sharedAtoms.contains(currentAtom)) {
currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); if (!currentAtom.equals(startAtom))
currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); if (!currentAtom.equals(startAtom))
Vector atomsToDraw = new Vector(); for (int i = 0; i < ring.getBondCount() - 2; i++) { currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); atomsToDraw.addElement(currentAtom);
Vector atomsToDraw = new Vector(); for (int i = 0; i < ring.getBondCount() - 2; i++) { currentBond = ring.getNextBond(currentBond, currentAtom); currentAtom = currentBond.getOther(currentAtom); atomsToDraw.addElement(currentAtom);