Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

AtomContainer Shallow Copy Behaviour

View gist:4136504
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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
Something went wrong with that request. Please try again.