Created
November 23, 2012 17:11
-
-
Save johnmay/4136504 to your computer and use it in GitHub Desktop.
AtomContainer Shallow Copy Behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IAtomContainer a = new AtomContainer(); | |
a.addAtom(new Atom("C")); | |
a.addAtom(new Atom("C")); | |
a.addBond(new Bond(a.getAtom(0), a.getAtom(1), SINGLE)); | |
// copy constructor | |
IAtomContainer b = new AtomContainer(a); | |
b.removeAtom(0); // atom at index 0 is removed from b, a is not affected | |
b.getBond(0).setOrder(DOUBLE); // bond order is change in both a and b | |
b.getBond(0).addAtom(new Atom("H")); // as the bond is the same instance this is now | |
ITetrahedralChiralAtomParityEtc element = ...; // access stereo elements | |
element.setStereo(CLOCKWISE); // a,b both have stereo changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment