Added unit test for tetrahedral chirality stereo element

Change-Id: Ia8db95fe4d3af3e518a030f971a525a63ea2dcda
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Added ability to setStereoElements - this was required due to clone() being shall on List. We need to be able to set a new array when have cloned a AtomContainer
Added unit tests for DoubleBond and AtomParity cloning

Change-Id: I1c0d5ee2f6bbe931492cf826a25cfde56d758716
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Reworked AtomContainer.clone() so it is clear what is going on. We now use a HashMap between the original and cloned atoms to avoid to a linear search each time the atom mapping is needed. This is also useful when we add StereoElement cloning (not yet implemented). We also store a bond mapping as well - we will need the bond mapping for double bond stereo chemistry. The stereo elements in the clone need to be set to an empty array on the clone so we don't remove elements from the original (cloning odditity). It was also clear we need to change the clone() method on Polymer which currently undoes all the cloning work we do in the AtomContainer. For all clone instances I added some code to correctly create HashMaps that won't need to resized. The default HashMap implementation works best at 0.75 capacity - we therefore need to do some simple arithmetic to ensure we don't get a resize. The implemented method is what is used in the Guava library.

Change-Id: I1b467707c630b1854a6665df67899a695427dfba
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Added a 'map' method on all IStereoElements. The map method allows a stereo element on one container/molecule to mapped to a stereo element on another. This mapping is achieved using two symbol tables, one for atoms and one for bonds. All methods are null safe and the mapping will not fail if any content in the stereo elements is null. The mapping simplifies the cloning of molecules/atom containers but could also be used when comparing isomorphic graphs.

Change-Id: I12c40b34a9b0b30f499eaa0ef29ae77e5caf07b0
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>

Conflicts:
	src/test/org/openscience/cdk/stereo/TetrahedralChiralityTest.java
Added stereo element shallow copy

Change-Id: Icbcb095271a5121c58fec1bca43e1f508b6a0e8c
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Added deep cloning of stereo element to atom containers and polymers (atom container subclass)

Change-Id: I344ba0fb0409f2e35858501e33b7d3ddcc8553a9
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Used return covariance on clone() to provide cleaner front-end API

Change-Id: Idaf10f55a17ba56bbf7052b4932c0f9b335db1c3
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>

Conflicts:
	src/main/org/openscience/cdk/Molecule.java
	src/main/org/openscience/cdk/debug/DebugMolecule.java
	src/main/org/openscience/cdk/silent/Molecule.java
Added unit tests for bugs 1270 (removalAllElements should remove stereo elements) and 1273 (double bond stereo chemistry constructor should throw an exception on wrong input). Added @cdk.bug tag for bug 1264 (stereo element cloning)

Change-Id: I71ebc95fe2fead344c305b7b505573378892c155
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Resolved NoNotify fails on AtomParity. Error was due to subclassing of AtomParity. Also the assertEquals params were swapped as the assertion was the wrong way.

Change-Id: Idebf543ef01e1f81f9bdb1264a1dea0088c8d752
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>

Conflicts:
	src/test/org/openscience/cdk/io/formats/CDKSourceCodeFormatTest.java
	src/test/org/openscience/cdk/nonotify/NNAtomParityTest.java
Adding CMLReaderTest of io module test suite

Change-Id: Ib03305b1c97ea4d876f67a536d8b714ed50113f1
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
added unit test to demonstrate bug and correct bug id's for two recents tests

Change-Id: If2c12c6dfaad4c7664b5ec6d439f8ddbec9f2ae9
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
- added unit test to demonstrate the bug
Compile fixes for merge with cdk-1.4.x: add missing method, and using new stronger typed clone() return values

Change-Id: I5fd59f8b068026857834911530e29c622be386f7
Moved methods for resetting the atom/bond data variables outside the store atom/bond data methods. The methods that store atom/bond data should not reset the variables immeditately to allow intuitive override behaviour.
Added finally cause to ensure the file is closed
Missing Se.2 atom type and test case

Change-Id: I3e47f8cc35bd7101c53d8146f68f5a3b691ec6ff
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Updated Gilleain's code to hook in with the other two new selenium atom types

Change-Id: I08649abd4dcf62c6ad23c50222156383360f2ed9
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
[bug:1274] added conditional to ensure that when multiple bond stereo is specified as attributes and characters only one is used. This is achieved by using the existing flag to determine if a stereo bond value has already been provided.

Change-Id: I2a4e64b1df2cbfdc5a3dfe5d8ff9a13c11f94e98
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
[bug:1275] added check to ensure that when String.substring is called the string is long enough