Patch for: https://sourceforge.net/p/cdk/bugs/1264/
This patch adds shallow and deep cloning of stereo-elements on atom containers and its subclasses. There was a couple of things I spotted as I was going along and so I patched these also.
All code is on stereo-element-cloning and some have sizeable commit messages but i'll step through the commits here also.
removed print to standard out from builders commit
removed redundant code from ChemObject.clone - a chunk could be replaced with standard collections API commit
added a new method on AtomContainer - setStereoElements() this was required because when the original container is cloned the list is only a shallow copy and we need make sure the old elements are changed when we modified the clone. A unit test were also added. commit
[large] reworked the atom container clone method to be more readable - it also now used
maps to convert between the original and cloned atoms without using a linear search for the index of the atom in the original. commit
[large] added and implemented a new method on stereo elements - the method allows us to map between one stereo element instance and another by providing a mapping of atoms and bonds. Unit tests were added for corner cases including how null should be handled commit
added shallow copy of stereo elements commit
added deep copy of stereo elements - this utilises the new map method on stereo elements commit
[large] rounding it all off with some non-destructive API changes - using return covariance we can return the correct type from a clone and thus eliminate the client side case :-) - commit
Most of the changes are quite straight forward but a couple are fairly large which I've indicated in the list above. I've tried to organise stuff to be easy to follow in the history but there might be some stuff out of order.