From: <eg...@us...> - 2008-10-02 13:15:44
|
Revision: 12531 http://cdk.svn.sourceforge.net/cdk/?rev=12531&view=rev Author: egonw Date: 2008-10-02 13:15:33 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Convert CML into CDK hydrogenCounts (closes #2142400) Modified Paths: -------------- cdk/branches/cdk-1.2.x/src/main/org/openscience/cdk/io/cml/CMLCoreModule.java Modified: cdk/branches/cdk-1.2.x/src/main/org/openscience/cdk/io/cml/CMLCoreModule.java =================================================================== --- cdk/branches/cdk-1.2.x/src/main/org/openscience/cdk/io/cml/CMLCoreModule.java 2008-10-02 13:15:00 UTC (rev 12530) +++ cdk/branches/cdk-1.2.x/src/main/org/openscience/cdk/io/cml/CMLCoreModule.java 2008-10-02 13:15:33 UTC (rev 12531) @@ -55,6 +55,7 @@ import org.openscience.cdk.interfaces.IReactionSet; import org.openscience.cdk.interfaces.IStrand; import org.openscience.cdk.tools.LoggingTool; +import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; import org.openscience.cdk.tools.manipulator.BondManipulator; import org.xml.sax.Attributes; @@ -1142,9 +1143,21 @@ } storeAtomData(); storeBondData(); + convertCMLToCDKHydrogenCounts(); } - protected void storeAtomData() { + private void convertCMLToCDKHydrogenCounts() { + for (IAtom atom : currentMolecule.atoms()) { + if (atom.getHydrogenCount() != null) { + int explicitHCount = AtomContainerManipulator.countExplicitHydrogens(currentMolecule, atom); + if (explicitHCount != 0) { + atom.setHydrogenCount(atom.getHydrogenCount() - explicitHCount); + } + } + } + } + + protected void storeAtomData() { logger.debug("No atoms: ", atomCounter); if (atomCounter == 0) { return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |