/** * {@inheritDoc} */ @Override public IAtom clone() throws CloneNotSupportedException { return atom.clone(); }
/** * {@inheritDoc} */ @Override public IAtom clone() throws CloneNotSupportedException { return atom.clone(); }
private static void addClone(IAtom atom, IAtomContainer mol, Map<IAtom, IAtom> map) { IAtom clonedAtom = null; try { clonedAtom = (IAtom) atom.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } mol.addAtom(clonedAtom); map.put(atom, clonedAtom); }
/** * Clones this LonePair object, including a clone of the atom for which the * lone pair is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { LonePair clone = (LonePair) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Clones this LonePair object, including a clone of the atom for which the * lone pair is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { LonePair clone = (LonePair) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Clones this SingleElectron object, including a clone of the atom for which the * SingleElectron is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { SingleElectron clone = (SingleElectron) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Clones this SingleElectron object, including a clone of the atom for which the * SingleElectron is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { SingleElectron clone = (SingleElectron) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Clones this SingleElectron object, including a clone of the atom for which the * SingleElectron is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { SingleElectron clone = (SingleElectron) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Clones this LonePair object, including a clone of the atom for which the * lone pair is defined. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { LonePair clone = (LonePair) super.clone(); // clone the Atom if (atom != null) { clone.atom = (IAtom) ((IAtom) atom).clone(); } return clone; }
/** * Method to test the clone() method */ @Test public void testClone_HydrogenCount() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setImplicitHydrogenCount(Integer.valueOf(3)); IAtom clone = (IAtom) atom.clone(); // test cloning atom.setImplicitHydrogenCount(Integer.valueOf(4)); Assert.assertEquals(3, clone.getImplicitHydrogenCount().intValue()); }
@Test public void testClone() throws Exception { IAtom hydrogen = new ImmutableHydrogen(); Assert.assertEquals(hydrogen, hydrogen.clone()); } }
/** * Method to test the clone() method */ @Test public void testClone_StereoParity() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setStereoParity(3); IAtom clone = (IAtom) atom.clone(); // test cloning atom.setStereoParity(4); Assert.assertEquals(3, clone.getStereoParity().intValue()); }
/** * Overwrite the method in {@link AbstractAtomTest} to always * expect zero hydrogen counts. */ @Test @Override public void testClone_HydrogenCount() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setImplicitHydrogenCount(3); IAtom clone = (IAtom) atom.clone(); // test cloning atom.setImplicitHydrogenCount(4); Assert.assertEquals(3, clone.getImplicitHydrogenCount().intValue()); }
/** * Overwrite the method in {@link AbstractAtomTypeTest} to always * expect zero stereo parity. */ @Test @Override public void testClone_StereoParity() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setStereoParity(3); IAtom clone = (IAtom) atom.clone(); // test cloning atom.setStereoParity(4); Assert.assertEquals(0, clone.getStereoParity().intValue()); }
/** * Method to test the clone() method */ @Test @Override public void testClone() throws Exception { IAtom atom = (IAtom) newChemObject(); Object clone = atom.clone(); Assert.assertTrue(clone instanceof IAtom); // test that everything has been cloned properly String diff = AtomDiff.diff(atom, (IAtom) clone); Assert.assertNotNull(diff); Assert.assertEquals(0, diff.length()); }
@Test @Category(SlowTest.class) public void testCalculate_NoModifications() throws Exception { IAtomContainer mol = someoneBringMeSomeWater(); IAtom atom = mol.getAtom(1); IAtom clone = (IAtom) mol.getAtom(1).clone(); descriptor.calculate(atom, mol); String diff = AtomDiff.diff(clone, atom); Assert.assertEquals("The descriptor must not change the passed atom in any respect, but found this diff: " + diff, 0, diff.length()); }
/** * Method to test the clone() method */ @Test public void testClone_Point3d() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setPoint3d(new Point3d(2, 3, 4)); IAtom clone = (IAtom) atom.clone(); Assert.assertEquals(clone.getPoint3d().x, 2.0, 0.001); }
/** * Method to test the clone() method */ @Test public void testClone_FractionalPoint3d() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setFractionalPoint3d(new Point3d(2, 3, 4)); IAtom clone = (IAtom) atom.clone(); Assert.assertEquals(clone.getFractionalPoint3d().x, 2.0, 0.001); }
/** * Method to test the clone() method */ @Test public void testClone_Charge() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setCharge(1.0); IAtom clone = (IAtom) atom.clone(); // test cloning atom.setCharge(5.0); Assert.assertEquals(1.0, clone.getCharge(), 0.001); }
/** * Method to test the clone() method */ @Test public void testClone_Point2d() throws Exception { IAtom atom = (IAtom) newChemObject(); atom.setPoint2d(new Point2d(2, 3)); IAtom clone = (IAtom) atom.clone(); Assert.assertEquals(clone.getPoint2d().x, 2.0, 0.001); }