/** * Remove the specified conformer. * * @param o The conformer to remove (should be castable to IAtomContainer) * @return true if the specified conformer was present and removed, false if not found */ @Override public boolean remove(Object o) { IAtomContainer atomContainer = (IAtomContainer) o; // we should never have a null conformer if (atomContainer == null) return false; int index = indexOf(atomContainer); if (index >= 0) { remove(index); return true; } return false; }
/** * Remove the specified conformer. * * @param o The conformer to remove (should be castable to IAtomContainer) * @return true if the specified conformer was present and removed, false if not found */ @Override public boolean remove(Object o) { IAtomContainer atomContainer = (IAtomContainer) o; // we should never have a null conformer if (atomContainer == null) return false; int index = indexOf(atomContainer); if (index >= 0) { remove(index); return true; } return false; }
@Test public void testRemove_int() { ConformerContainer container = new ConformerContainer(confs); container.clear(); Assert.assertEquals(0, container.size()); for (int i = 0; i < nconfs; i++) container.add(confs[i]); Assert.assertEquals(nconfs, container.size()); container.remove(0); Assert.assertEquals(nconfs - 1, container.size()); }
@Test public void testRemove_Object() { ConformerContainer cContainer = new ConformerContainer(confs); Assert.assertEquals(nconfs, cContainer.size()); IAtomContainer container = cContainer.get(3); Assert.assertTrue(cContainer.contains(container)); cContainer.remove(container); Assert.assertEquals(nconfs - 1, cContainer.size()); Assert.assertFalse(cContainer.contains(container)); }