/** * {@inheritDoc} */ @Override public IBond clone() throws CloneNotSupportedException { return bond.clone(); }
/** * {@inheritDoc} */ @Override public IBond clone() throws CloneNotSupportedException { return bond.clone(); }
@Test public void testCalculate_NoModifications() throws Exception { IAtomContainer mol = someoneBringMeSomeWater(); IBond bond = mol.getBond(0); IBond clone = (IBond) mol.getBond(0).clone(); descriptor.calculate(bond, mol); String diff = BondDiff.diff(clone, bond); Assert.assertEquals("(" + descriptor.getClass().toString() + ") The descriptor must not change the passed bond in any respect, but found this diff: " + diff, 0, diff.length()); }
clone = (IBond) ac.getBond(i).clone(); } catch (CloneNotSupportedException e) { e.printStackTrace();
IBond bond = (IBond) original.clone(); int n = bond.getAtomCount(); IAtom[] members = new IAtom[n];
IBond bond = (IBond) original.clone(); int n = bond.getAtomCount(); IAtom[] members = new IAtom[n];
clone = (IBond) atomContainer.getBond(i).clone(); } catch (CloneNotSupportedException e) {
IBond bond = (IBond) original.clone(); int n = bond.getAtomCount(); IAtom[] members = new IAtom[n];
@Test @Override public void testClone() throws Exception { IBond bond = (IBond) newChemObject(); Object clone = bond.clone(); Assert.assertNotNull(clone); Assert.assertTrue(clone instanceof org.openscience.cdk.interfaces.IBond); }
clone = (IBond) atomContainer.getBond(i).clone(); } catch (CloneNotSupportedException e) {
newBond = (IBond) bond.clone(); IAtom[] newAtoms = new IAtom[bond.getAtomCount()]; for (int j = 0; j < bond.getAtomCount(); ++j) {
newBond = (IBond) bond.clone(); IAtom[] newAtoms = new IAtom[bond.getAtomCount()]; for (int j = 0; j < bond.getAtomCount(); ++j) {
newBond = (IBond) bond.clone(); IAtom[] newAtoms = new IAtom[bond.getAtomCount()]; for (int j = 0; j < bond.getAtomCount(); ++j) {
private static IAtomContainer permuteA(int[] p, IAtomContainer atomContainer) { IAtomContainer permutedContainer = null; try { permutedContainer = atomContainer.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < p.length; i++) { IAtom atom = atomContainer.getAtom(p[i]); permutedContainer.addAtom((IAtom) atom.clone()); } for (IBond bond : atomContainer.bonds()) { IBond clonedBond = (IBond) bond.clone(); clonedBond.setAtoms(new IAtom[clonedBond.getAtomCount()]); int i = 0; for (IAtom atom : bond.atoms()) { int index = atomContainer.indexOf(atom); IAtom permutedAtom = permutedContainer.getAtom(p[index]); clonedBond.setAtom(permutedAtom, i++); } permutedContainer.addBond(clonedBond); } } catch (CloneNotSupportedException cne) { //? System.out.println(cne); } return permutedContainer; }
private static IAtomContainer permuteA(int[] p, IAtomContainer atomContainer) { IAtomContainer permutedContainer = null; try { permutedContainer = atomContainer.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < p.length; i++) { IAtom atom = atomContainer.getAtom(p[i]); permutedContainer.addAtom(atom.clone()); } for (IBond bond : atomContainer.bonds()) { IBond clonedBond = bond.clone(); clonedBond.setAtoms(new IAtom[clonedBond.getAtomCount()]); int i = 0; for (IAtom atom : bond.atoms()) { int index = atomContainer.indexOf(atom); IAtom permutedAtom = permutedContainer.getAtom(p[index]); clonedBond.setAtom(permutedAtom, i++); } permutedContainer.addBond(clonedBond); } } catch (CloneNotSupportedException cne) { //? out.println(cne); } return permutedContainer; }
@Test public void testClone_Order() throws Exception { IChemObject object = newChemObject(); IAtom atom1 = object.getBuilder().newInstance(IAtom.class, "C"); IAtom atom2 = object.getBuilder().newInstance(IAtom.class, "O"); IBond bond = object.getBuilder().newInstance(IBond.class, atom1, atom2, IBond.Order.SINGLE); IBond clone = (IBond) bond.clone(); // test cloning of bond order bond.setOrder(IBond.Order.DOUBLE); Assert.assertEquals(IBond.Order.SINGLE, clone.getOrder()); }
@Test public void testClone_Stereo() throws Exception { IChemObject object = newChemObject(); IAtom atom1 = object.getBuilder().newInstance(IAtom.class, "C"); IAtom atom2 = object.getBuilder().newInstance(IAtom.class, "O"); IBond bond = object.getBuilder().newInstance(IBond.class, atom1, atom2, IBond.Order.SINGLE, IBond.Stereo.UP); IBond clone = (IBond) bond.clone(); // test cloning of bond order bond.setStereo(IBond.Stereo.UP_INVERTED); Assert.assertEquals(IBond.Stereo.UP, clone.getStereo()); }
@Test public void testClone_IAtom() throws Exception { IChemObject object = newChemObject(); IAtom atom1 = object.getBuilder().newInstance(IAtom.class, "C"); IAtom atom2 = object.getBuilder().newInstance(IAtom.class, "O"); IBond bond = object.getBuilder().newInstance(IBond.class, atom1, atom2); IBond clone = (IBond) bond.clone(); // test cloning of atoms Assert.assertNotSame(atom1, clone.getBegin()); Assert.assertNotSame(atom2, clone.getEnd()); }
for (int i = 0; i < getBondCount(); ++i) { bond = getBond(i); newBond = (IBond) bond.clone(); newAtoms = new IAtom[bond.getAtomCount()]; for (int j = 0; j < bond.getAtomCount(); ++j) {