From: <eg...@us...> - 2008-09-07 08:25:44
|
Revision: 12216 http://cdk.svn.sourceforge.net/cdk/?rev=12216&view=rev Author: egonw Date: 2008-09-07 08:25:34 +0000 (Sun, 07 Sep 2008) Log Message: ----------- Merge branch 'cdk-1.2.x' Modified Paths: -------------- cdk/trunk/build.props cdk/trunk/pmd/custom-test.xml cdk/trunk/pmd/customJunit.xml cdk/trunk/pmd/migrating.xml cdk/trunk/pmd-migrating.xml cdk/trunk/pmd.xml cdk/trunk/src/main/org/openscience/cdk/RingSet.java cdk/trunk/src/main/org/openscience/cdk/atomtype/SybylAtomTypeMatcher.java cdk/trunk/src/main/org/openscience/cdk/charges/MMFF94PartialCharges.java cdk/trunk/src/main/org/openscience/cdk/debug/DebugRingSet.java cdk/trunk/src/main/org/openscience/cdk/geometry/CrystalGeometryTools.java cdk/trunk/src/main/org/openscience/cdk/graph/SpanningTree.java cdk/trunk/src/main/org/openscience/cdk/interfaces/IRingSet.java cdk/trunk/src/main/org/openscience/cdk/io/CMLReader.java cdk/trunk/src/main/org/openscience/cdk/io/INChIReader.java cdk/trunk/src/main/org/openscience/cdk/layout/RingPlacer.java cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MMFF94BasedParameterSetReader.java cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MMFF94ParametersCall.java cdk/trunk/src/main/org/openscience/cdk/modeling/forcefield/AngleBending.java cdk/trunk/src/main/org/openscience/cdk/modeling/forcefield/BondStretching.java cdk/trunk/src/main/org/openscience/cdk/modeling/forcefield/StretchBendInteractions.java cdk/trunk/src/main/org/openscience/cdk/modeling/forcefield/Torsions.java cdk/trunk/src/main/org/openscience/cdk/modeling/forcefield/VanDerWaalsInteractions.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GDR.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHR.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHR_topol.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GSR.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/atomic/StabilizationPlusChargeDescriptor.java cdk/trunk/src/main/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java cdk/trunk/src/main/org/openscience/cdk/ringsearch/FiguerasSSSRFinder.java cdk/trunk/src/main/org/openscience/cdk/ringsearch/RingPartitioner.java cdk/trunk/src/main/org/openscience/cdk/ringsearch/SSSRFinder.java cdk/trunk/src/main/org/openscience/cdk/smiles/SmilesParser.java cdk/trunk/src/main/org/openscience/cdk/smiles/smarts/SMARTSQueryTool.java cdk/trunk/src/main/org/openscience/cdk/tools/CDKValencyChecker.java cdk/trunk/src/main/org/openscience/cdk/tools/IValencyChecker.java cdk/trunk/src/main/org/openscience/cdk/tools/IonizationPotentialTool.java cdk/trunk/src/main/org/openscience/cdk/tools/manipulator/RingSetManipulator.java cdk/trunk/src/test/org/openscience/cdk/RingSetTest.java cdk/trunk/src/test/org/openscience/cdk/atomtype/SybylAtomTypeMatcherTest.java cdk/trunk/src/test/org/openscience/cdk/smiles/SmilesGeneratorTest.java cdk/trunk/src/test/org/openscience/cdk/smiles/SmilesParserTest.java cdk/trunk/src/test/org/openscience/cdk/smiles/smarts/parser/ParserTest.java Added Paths: ----------- cdk/trunk/pmd/custom-qm.xml cdk/trunk/pmd/migrating-qm.xml cdk/trunk/src/test/data/cml/test1.cml Modified: cdk/trunk/build.props =================================================================== --- cdk/trunk/build.props 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/build.props 2008-09-07 08:25:34 UTC (rev 12216) @@ -1,2 +1 @@ -version=svn-20080221 -jcp.version=2.3.2 +version=cdk-1.2.x-alpha Added: cdk/trunk/pmd/custom-qm.xml =================================================================== --- cdk/trunk/pmd/custom-qm.xml (rev 0) +++ cdk/trunk/pmd/custom-qm.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<ruleset name="custom-data"> + + <description> + This ruleset checks the CDK sources for bad code. + </description> + + <!-- In the below paths, rulesets/ refers to the classpath, and the + pmd/ refers to this directory, and needs to be excluded because + the are called from ../pmd.xml --> + + <!-- The rule sets that come with PMD --> + + <rule ref="rulesets/basic.xml"/> + <rule ref="pmd/customNaming.xml"/> + <rule ref="rulesets/unusedcode.xml"/> + <rule ref="rulesets/imports.xml"/> + <rule ref="rulesets/strings.xml"/> + <rule ref="rulesets/codesize.xml"> + <exclude name="TooManyMethods"/> + <exclude name="ExcessivePublicCount"/> + </rule> + <rule ref="rulesets/strictexception.xml"/> + <rule ref="pmd/migrating-qm.xml"/> + + <!-- Rules specific for CDK --> + + <rule ref="pmd/customCDK.xml"/> + <rule ref="pmd/customOptimization.xml"/> + +</ruleset> Modified: cdk/trunk/pmd/custom-test.xml =================================================================== --- cdk/trunk/pmd/custom-test.xml 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/pmd/custom-test.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -14,6 +14,7 @@ <rule ref="rulesets/basic.xml"/> <rule ref="rulesets/unusedcode.xml"/> <rule ref="rulesets/imports.xml"/> + <rule ref="rulesets/migrating_to_junit4.xml"/> <!-- Rules specific for CDK --> Modified: cdk/trunk/pmd/customJunit.xml =================================================================== --- cdk/trunk/pmd/customJunit.xml 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/pmd/customJunit.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -8,5 +8,7 @@ <rule ref="rulesets/junit.xml"> <exclude name="JUnitAssertionsShouldIncludeMessage"/> </rule> + + <!-- to JUnit4 migration tested in migration*.xml --> </ruleset> Copied: cdk/trunk/pmd/migrating-qm.xml (from rev 12187, cdk/trunk/pmd/migrating.xml) =================================================================== --- cdk/trunk/pmd/migrating-qm.xml (rev 0) +++ cdk/trunk/pmd/migrating-qm.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<ruleset name="custom"> + + <description> + This ruleset checks for migration clean up in the CDK sources. + </description> + + <!-- The rule sets that come with PMD --> + + <rule ref="rulesets/migrating_to_13.xml"> + <exclude name="ReplaceVectorWithList"/> + </rule> + <rule ref="rulesets/migrating_to_14.xml"/> + <rule ref="rulesets/migrating_to_15.xml"/> + <rule ref="rulesets/migrating_to_junit4.xml"/> + +</ruleset> Modified: cdk/trunk/pmd/migrating.xml =================================================================== --- cdk/trunk/pmd/migrating.xml 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/pmd/migrating.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -10,5 +10,6 @@ <rule ref="rulesets/migrating_to_13.xml"/> <rule ref="rulesets/migrating_to_14.xml"/> <rule ref="rulesets/migrating_to_15.xml"/> + <rule ref="rulesets/migrating_to_junit4.xml"/> </ruleset> Modified: cdk/trunk/pmd-migrating.xml =================================================================== --- cdk/trunk/pmd-migrating.xml 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/pmd-migrating.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -27,57 +27,57 @@ <target name="pmd" id="pmd"> <!-- the data classes modules --> - <antcall target="test-module"><param name="module" value="data"/></antcall> - <antcall target="test-module"><param name="module" value="datadebug"/></antcall> - <antcall target="test-module"><param name="module" value="nonotify"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="data"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="datadebug"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="nonotify"/></antcall> <!-- the other modules --> - <antcall target="test-module"><param name="module" value="interfaces"/></antcall> - <antcall target="test-module"><param name="module" value="core"/></antcall> - <antcall target="test-module"><param name="module" value="standard"/></antcall> - <antcall target="test-module"><param name="module" value="atomtype"/></antcall> - <antcall target="test-module"><param name="module" value="io"/></antcall> - <antcall target="test-module"><param name="module" value="extra"/></antcall> - <antcall target="test-module"><param name="module" value="formula"/></antcall> - <antcall target="test-module"><param name="module" value="render"/></antcall> - <antcall target="test-module"><param name="module" value="reaction"/></antcall> - <antcall target="test-module"><param name="module" value="libiocml"/></antcall> - <antcall target="test-module"><param name="module" value="builder3d"/></antcall> - <antcall target="test-module"><param name="module" value="smiles"/></antcall> - <antcall target="test-module"><param name="module" value="smarts"/></antcall> - <antcall target="test-module"><param name="module" value="pcore"/></antcall> - <antcall target="test-module"><param name="module" value="forcefield"/></antcall> - <antcall target="test-module"><param name="module" value="qsar"/></antcall> - <antcall target="test-module"><param name="module" value="qsaratomic"/></antcall> - <antcall target="test-module"><param name="module" value="qsarbond"/></antcall> - <antcall target="test-module"><param name="module" value="qsarmolecular"/></antcall> - <antcall target="test-module"><param name="module" value="qsarprotein"/></antcall> - <antcall target="test-module"><param name="module" value="structgen"/></antcall> - <antcall target="test-module"><param name="module" value="valencycheck"/></antcall> - <antcall target="test-module"><param name="module" value="charges"/></antcall> - <antcall target="test-module"><param name="module" value="diff"/></antcall> - <antcall target="test-module"><param name="module" value="qm"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="interfaces"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="core"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="standard"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="atomtype"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="io"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="extra"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="formula"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="render"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="reaction"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="libiocml"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="builder3d"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="smiles"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="smarts"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="pcore"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="forcefield"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="qsar"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="qsaratomic"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="qsarbond"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="qsarmolecular"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="qsarprotein"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="structgen"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="valencycheck"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="charges"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="diff"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration-qm"/><param name="module" value="qm"/></antcall> <!-- the test modules --> - <antcall target="test-module"><param name="module" value="test-core"/></antcall> - <antcall target="test-module"><param name="module" value="test-data"/></antcall> - <antcall target="test-module"><param name="module" value="test-datadebug"/></antcall> - <antcall target="test-module"><param name="module" value="test-nonotify"/></antcall> - <antcall target="test-module"><param name="module" value="test-atomtype"/></antcall> - <antcall target="test-module"><param name="module" value="test-extra"/></antcall> - <antcall target="test-module"><param name="module" value="test-forcefield"/></antcall> - <antcall target="test-module"><param name="module" value="test-io"/></antcall> - <antcall target="test-module"><param name="module" value="test-reaction"/></antcall> - <antcall target="test-module"><param name="module" value="test-smiles"/></antcall> - <antcall target="test-module"><param name="module" value="test-standard"/></antcall> - <antcall target="test-module"><param name="module" value="test-valencycheck"/></antcall> - <antcall target="test-module"><param name="module" value="test-charges"/></antcall> - <antcall target="test-module"><param name="module" value="test-pcore"/></antcall> - <antcall target="test-module"><param name="module" value="test-qsar"/></antcall> - <antcall target="test-module"><param name="module" value="test-qsaratomic"/></antcall> - <antcall target="test-module"><param name="module" value="test-qsarbond"/></antcall> - <antcall target="test-module"><param name="module" value="test-qsarmolecular"/></antcall> - <antcall target="test-module"><param name="module" value="test-qsarprotein"/></antcall> - <antcall target="test-module"><param name="module" value="test-diff"/></antcall> - <antcall target="test-module"><param name="module" value="test-qm"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-core"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-data"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-datadebug"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-nonotify"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-atomtype"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-extra"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-forcefield"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-io"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-reaction"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-smiles"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-standard"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-valencycheck"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-charges"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-pcore"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qsar"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qsaratomic"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qsarbond"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qsarmolecular"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qsarprotein"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-diff"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="migration"/><param name="module" value="test-qm"/></antcall> </target> <target id="test-module" name="test-module" @@ -86,7 +86,8 @@ <echo message="Checking for migrating code updates in CDK's ${module} module." /> <mkdir dir="${reports.tests}/pmd-migrating"/> - <pmd shortFilenames="true" rulesetfiles="pmd/migrating.xml"> + + <pmd shortFilenames="true" rulesetfiles="pmd/${pmd.test}.xml"> <formatter type="xml" toFile="${reports.tests}/pmd-migrating/${module}.xml"/> <fileset dir="${src}/main"> <includesfile name="${build}/${module}.javafiles"/> Modified: cdk/trunk/pmd.xml =================================================================== --- cdk/trunk/pmd.xml 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/pmd.xml 2008-09-07 08:25:34 UTC (rev 12216) @@ -55,7 +55,7 @@ <antcall target="test-module"><param name="pmd.test" value="custom"/><param name="module" value="valencycheck"/></antcall> <antcall target="test-module"><param name="pmd.test" value="custom"/><param name="module" value="charges"/></antcall> <antcall target="test-module"><param name="pmd.test" value="custom"/><param name="module" value="diff"/></antcall> - <antcall target="test-module"><param name="pmd.test" value="custom"/><param name="module" value="qm"/></antcall> + <antcall target="test-module"><param name="pmd.test" value="custom-qm"/><param name="module" value="qm"/></antcall> <!-- the test modules --> <antcall target="test-module"><param name="pmd.test" value="custom-test"/><param name="module" value="test-core"/></antcall> <antcall target="test-module"><param name="pmd.test" value="custom-test"/><param name="module" value="test-data"/></antcall> Modified: cdk/trunk/src/main/org/openscience/cdk/RingSet.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/RingSet.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/RingSet.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -25,8 +25,6 @@ package org.openscience.cdk; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; @@ -68,16 +66,16 @@ * @return A vector of all rings that this bond is part of */ - public List<IRing> getRings(IBond bond) + public IRingSet getRings(IBond bond) { - List<IRing> rings = new ArrayList<IRing>(); + IRingSet rings = bond.getBuilder().newRingSet(); Ring ring; for (int i = 0; i < getAtomContainerCount(); i++) { ring = (Ring)getAtomContainer(i); if (ring.contains(bond)) { - rings.add(ring); + rings.addAtomContainer(ring); } } return rings; @@ -113,9 +111,9 @@ * @return All the rings that share one or more atoms with a given ring. */ - public List<IRing> getConnectedRings(IRing ring) + public IRingSet getConnectedRings(IRing ring) { - List<IRing> connectedRings = new ArrayList<IRing>(); + IRingSet connectedRings = ring.getBuilder().newRingSet(); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) @@ -126,7 +124,7 @@ tempRing = (IRing)getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { - connectedRings.add(tempRing); + connectedRings.addAtomContainer(tempRing); } } } Modified: cdk/trunk/src/main/org/openscience/cdk/atomtype/SybylAtomTypeMatcher.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/atomtype/SybylAtomTypeMatcher.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/atomtype/SybylAtomTypeMatcher.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -74,6 +74,7 @@ for (IAtom atom : atomContainer.atoms()) { IAtomType type = cdkMatcher.findMatchingAtomType(atomContainer, atom); atom.setAtomTypeName(type == null ? null : type.getAtomTypeName()); + atom.setHybridization(type == null ? null : type.getHybridization()); } CDKHueckelAromaticityDetector.detectAromaticity(atomContainer); IAtomType[] types = new IAtomType[atomContainer.getAtomCount()]; Modified: cdk/trunk/src/main/org/openscience/cdk/charges/MMFF94PartialCharges.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/charges/MMFF94PartialCharges.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/charges/MMFF94PartialCharges.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -21,9 +21,8 @@ */ package org.openscience.cdk.charges; -import java.util.Hashtable; import java.util.Map; -import java.util.Vector; +import java.util.List; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; @@ -75,7 +74,7 @@ ForceFieldConfigurator ffc = new ForceFieldConfigurator(); ffc.setForceFieldConfigurator("mmff94"); ffc.assignAtomTyps((IMolecule)ac); - Map parameterSet = ffc.getParameterSet(); + Map<String,List> parameterSet = ffc.getParameterSet(); // for this calculation, // we need some values stored in the vector "data" in the // hashtable of these atomTypes: @@ -86,30 +85,30 @@ double sumOfFormalCharges = 0; double sumOfBondIncrements = 0; org.openscience.cdk.interfaces.IAtom thisAtom = null; - java.util.List<IAtom> neighboors; - Vector data = null; - Vector bondData = null; - Vector dataNeigh = null; + List<IAtom> neighboors; + List data = null; + List bondData = null; + List dataNeigh = null; java.util.Iterator<IAtom> atoms = ac.atoms().iterator(); while(atoms.hasNext()) { //logger.debug("ATOM "+i+ " " +atoms[i].getSymbol()); thisAtom = atoms.next(); - data = (Vector) parameterSet.get("data"+thisAtom.getAtomTypeName()); + data = parameterSet.get("data"+thisAtom.getAtomTypeName()); neighboors = ac.getConnectedAtomsList(thisAtom); formalCharge = thisAtom.getCharge(); - theta = (Double) data.get(5); + theta = (Double)data.get(5); charge = formalCharge * (1 - (neighboors.size() * theta)); sumOfFormalCharges = 0; sumOfBondIncrements = 0; for (IAtom neighboor : neighboors) { IAtom neighbour = (IAtom) neighboor; - dataNeigh = (Vector) parameterSet.get("data" + neighbour.getAtomTypeName()); + dataNeigh = parameterSet.get("data" + neighbour.getAtomTypeName()); if (parameterSet.containsKey("bond" + thisAtom.getAtomTypeName() + ";" + neighbour.getAtomTypeName())) { - bondData = (Vector) parameterSet.get("bond" + thisAtom.getAtomTypeName() + ";" + neighbour.getAtomTypeName()); + bondData = parameterSet.get("bond" + thisAtom.getAtomTypeName() + ";" + neighbour.getAtomTypeName()); sumOfBondIncrements -= (Double) bondData.get(4); } else if (parameterSet.containsKey("bond" + neighbour.getAtomTypeName() + ";" + thisAtom.getAtomTypeName())) { - bondData = (Vector) parameterSet.get("bond" + neighbour.getAtomTypeName() + ";" + thisAtom.getAtomTypeName()); + bondData = parameterSet.get("bond" + neighbour.getAtomTypeName() + ";" + thisAtom.getAtomTypeName()); sumOfBondIncrements += (Double) bondData.get(4); } else { // Maybe not all bonds have pbci in mmff94.prm, i.e. C-N @@ -117,7 +116,7 @@ } - dataNeigh = (Vector) parameterSet.get("data" + neighbour.getID()); + dataNeigh = parameterSet.get("data" + neighbour.getID()); formalChargeNeigh = neighbour.getCharge(); sumOfFormalCharges += formalChargeNeigh; } Modified: cdk/trunk/src/main/org/openscience/cdk/debug/DebugRingSet.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/debug/DebugRingSet.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/debug/DebugRingSet.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -20,8 +20,6 @@ */ package org.openscience.cdk.debug; -import java.util.List; - import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IBond; import org.openscience.cdk.interfaces.IRing; @@ -46,7 +44,7 @@ super(); } - public List getRings(IBond bond) { + public IRingSet getRings(IBond bond) { logger.debug("Getting rings for bond: ", bond); return super.getRings(bond); } @@ -56,7 +54,7 @@ return super.getRings(atom); } - public List getConnectedRings(IRing ring) { + public IRingSet getConnectedRings(IRing ring) { logger.debug("Getting connected rings for ring: ", ring); return super.getConnectedRings(ring); } Modified: cdk/trunk/src/main/org/openscience/cdk/geometry/CrystalGeometryTools.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/geometry/CrystalGeometryTools.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/geometry/CrystalGeometryTools.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -96,31 +96,6 @@ } /** - * Method that transforms fractional coordinates into cartesian coordinates. - * - * @param aAxis the a axis vector of the unit cell in cartesian coordinates - * @param bAxis the b axis vector of the unit cell in cartesian coordinates - * @param cAxis the c axis vector of the unit cell in cartesian coordinates - * @param frac a fractional coordinate to convert - * @return an array of length 3 with the cartesian coordinates of the - * point defined by frac - * - * @cdk.keyword cartesian coordinates - * @cdk.keyword fractional coordinates - * - * @see #cartesianToFractional(javax.vecmath.Vector3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d, javax.vecmath.Point3d) - * @deprecated - */ - public static double[] fractionalToCartesian(double[] aAxis, double[] bAxis, double[] cAxis, - double[] frac) { - double[] cart = new double[3]; - cart[0] = frac[0]*aAxis[0] + frac[1]*bAxis[0] + frac[2]*cAxis[0]; - cart[1] = frac[0]*aAxis[1] + frac[1]*bAxis[1] + frac[2]*cAxis[1]; - cart[2] = frac[0]*aAxis[2] + frac[1]*bAxis[2] + frac[2]*cAxis[2]; - return cart; - } - - /** * @cdk.dictref blue-obelisk:convertFractionIntoCartesianCoordinates */ @TestMethod("testFractionalToCartesian_Vector3d_Vector3d_Vector3d_Point3d") @@ -134,19 +109,6 @@ } /** - * @deprecated - */ - public static Point3d fractionalToCartesian(double[] aAxis, double[] bAxis, double[] cAxis, - Point3d fracPoint) { - double[] frac = new double[3]; - frac[0] = fracPoint.x; - frac[1] = fracPoint.y; - frac[2] = fracPoint.z; - double[] cart = fractionalToCartesian(aAxis,bAxis,cAxis, frac); - return new Point3d(cart[0], cart[1], cart[2]); - } - - /** * Calculates cartesian vectors for unit cell axes from axes lengths and angles * between axes. * Modified: cdk/trunk/src/main/org/openscience/cdk/graph/SpanningTree.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/graph/SpanningTree.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/graph/SpanningTree.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -28,10 +28,12 @@ import org.openscience.cdk.annotations.TestClass; import org.openscience.cdk.annotations.TestMethod; import org.openscience.cdk.exception.NoSuchAtomException; -import org.openscience.cdk.interfaces.*; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IBond; +import org.openscience.cdk.interfaces.IRing; +import org.openscience.cdk.interfaces.IRingSet; -import java.util.Iterator; - /** * Spanning tree of a molecule. * Used to discover the number of cyclic bonds in order to prevent the @@ -154,8 +156,7 @@ cb[i][a] = 0; // remove ATOM_NUMBER props again - Iterator atoms = atomContainer.atoms().iterator(); - while (atoms.hasNext()) ((IAtom)atoms.next()).removeProperty(ATOM_NUMBER); + for (IAtom atom : atomContainer.atoms()) atom.removeProperty(ATOM_NUMBER); } @TestMethod("testGetSpanningTree") @@ -172,7 +173,8 @@ IAtomContainer path = spt.getBuilder().newAtomContainer(); PathTools.resetFlags(spt); path.addAtom(a1); - PathTools.depthFirstTargetSearch(spt,a1,a2,path); + PathTools.depthFirstTargetSearch(spt,a1,a2,path); + if (path.getAtomCount() == 1) path.removeAtom(a1); // no path found: remove initial atom return path; } Modified: cdk/trunk/src/main/org/openscience/cdk/interfaces/IRingSet.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/interfaces/IRingSet.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/interfaces/IRingSet.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -23,7 +23,6 @@ */ package org.openscience.cdk.interfaces; -import java.util.List; /** * Maintains a set of Ring objects. @@ -41,7 +40,7 @@ * @param bond The bond to be checked * @return A vector of all rings that this bond is part of */ - public List<IRing> getRings(IBond bond); + public IRingSet getRings(IBond bond); /** * Returns a vector of all rings that this atom is part of. @@ -58,7 +57,7 @@ * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ - public List<IRing> getConnectedRings(IRing ring); + public IRingSet getConnectedRings(IRing ring); /** * Adds all rings of another RingSet if they are not allready part of this ring set. Modified: cdk/trunk/src/main/org/openscience/cdk/io/CMLReader.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/io/CMLReader.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/io/CMLReader.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -25,13 +25,11 @@ */ package org.openscience.cdk.io; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.Reader; -import java.io.StringReader; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import org.openscience.cdk.exception.CDKException; @@ -64,39 +62,25 @@ public class CMLReader extends DefaultChemObjectReader { private XMLReader parser; - private Reader input; + private InputStream input; private String url; - private Map userConventions = new HashMap(); + private Map<String,ICMLModule> userConventions = new HashMap<String,ICMLModule>(); private LoggingTool logger; /** - * Define this CMLReader to take the input from a java.io.Reader - * class. Possible readers are (among others) StringReader and FileReader. - * FIXME: this can not be used in combination with Aelfred2 yet. - * - * @param input Reader type input - * - * @deprecated XML reading should not be done with a Reader, but with an - * InputStream instead. - */ - public CMLReader(Reader input) { - this.init(); - this.input = input; - } - - /** * Reads CML from an java.io.InputStream, for example the FileInputStream. * * @param input InputStream type input */ public CMLReader(InputStream input) { - this(new InputStreamReader(input)); + this.input = input; + init(); } public CMLReader() { - this(new StringReader("")); + this(new ByteArrayInputStream(new byte[0])); } public void registerConvention(String convention, ICMLModule conv) { @@ -118,12 +102,16 @@ return CMLFormat.getInstance(); } + /** + * This method must not be used; XML reading requires the use of an InputStream. + * Use setReader(InputStream) instead. + */ public void setReader(Reader reader) throws CDKException { - this.input = reader; + throw new CDKException("Invalid method call; use SetReader(InputStream) instead."); } public void setReader(InputStream input) throws CDKException { - setReader(new InputStreamReader(input)); + this.input = input; } private void init() { @@ -214,10 +202,8 @@ } CMLHandler handler = new CMLHandler(file); // copy the manually added conventions - Iterator conventions = userConventions.keySet().iterator(); - while (conventions.hasNext()) { - String conv = (String)conventions.next(); - handler.registerConvention(conv, (ICMLModule)userConventions.get(conv)); + for (String conv : userConventions.keySet()) { + handler.registerConvention(conv, userConventions.get(conv)); } parser.setContentHandler(handler); parser.setEntityResolver(new CMLResolver()); Modified: cdk/trunk/src/main/org/openscience/cdk/io/INChIReader.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/io/INChIReader.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/io/INChIReader.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -28,15 +28,14 @@ */ package org.openscience.cdk.io; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.io.Reader; -import java.io.StringReader; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IChemFile; import org.openscience.cdk.interfaces.IChemObject; -import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.io.formats.INChIFormat; import org.openscience.cdk.io.formats.IResourceFormat; import org.openscience.cdk.io.inchi.INChIHandler; @@ -68,46 +67,38 @@ public class INChIReader extends DefaultChemObjectReader { private XMLReader parser; - private Reader input; + private InputStream input; private LoggingTool logger; /** - * Construct a INChI reader from a Reader object. - * - * @param input the Reader with the content - * - * @deprecated XML parsing should use InputStream instead of a Reader. - */ - public INChIReader(Reader input) { - this.init(); - this.input = input; - } - - /** * Construct a INChI reader from a InputStream object. * * @param input the InputStream with the content */ public INChIReader(InputStream input) { - this(new InputStreamReader(input)); + this.input = input; + init(); } public INChIReader() { - this(new StringReader("")); + this(new ByteArrayInputStream(new byte[0])); } public IResourceFormat getFormat() { return INChIFormat.getInstance(); } - - public void setReader(Reader input) throws CDKException { - this.input = input; + /** + * This method must not be used; XML reading requires the use of an InputStream. + * Use setReader(InputStream) instead. + */ + public void setReader(Reader reader) throws CDKException { + throw new CDKException("Invalid method call; use SetReader(InputStream) instead."); } public void setReader(InputStream input) throws CDKException { - setReader(new InputStreamReader(input)); + this.input = input; } /** Modified: cdk/trunk/src/main/org/openscience/cdk/layout/RingPlacer.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/layout/RingPlacer.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/layout/RingPlacer.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -28,8 +28,6 @@ */ package org.openscience.cdk.layout; -import java.util.Iterator; -import java.util.List; import java.util.Vector; import javax.vecmath.Point2d; @@ -629,7 +627,7 @@ */ void placeConnectedRings(IRingSet rs, IRing ring, int handleType, double bondLength) { - List connectedRings = rs.getConnectedRings(ring); + IRingSet connectedRings = rs.getConnectedRings(ring); IRing connectedRing; IAtomContainer sharedAtoms; int sac; @@ -637,9 +635,8 @@ Vector2d tempVector, oldRingCenterVector, newRingCenterVector; // logger.debug(rs.reportRingList(molecule)); - Iterator iter = connectedRings.iterator(); - while (iter.hasNext()) { - connectedRing = (IRing)iter.next(); + for (IAtomContainer container : connectedRings.atomContainers()) { + connectedRing = (IRing)container; if (!connectedRing.getFlag(CDKConstants.ISPLACED)) { // logger.debug(ring.toString(molecule)); Modified: cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -24,27 +24,33 @@ */ package org.openscience.cdk.modeling.builder3d; +import java.io.InputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.NoSuchAtomTypeException; -import org.openscience.cdk.interfaces.*; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IAtomType; +import org.openscience.cdk.interfaces.IBond; +import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.IPseudoAtom; +import org.openscience.cdk.interfaces.IRing; +import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.ringsearch.SSSRFinder; import org.openscience.cdk.tools.HOSECodeGenerator; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; import org.openscience.cdk.tools.manipulator.RingSetManipulator; -import java.io.InputStream; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * Reads in a force field configuration file, set the atom types into a vector, and the data into a hashtable - * Therfore it uses the class MM2BasedParamterSetReader + * Therefore, it uses the class {@link MM2BasedParameterSetReader}. * private Hashtable parameterSet; * key=nameofdatafield+atomid1+;atomid2;atomxid * @@ -260,7 +266,7 @@ ringSetA = ringSetMolecule.getRings(atom); RingSetManipulator.sort(ringSetA); IRing sring = (IRing) ringSetA.getAtomContainer(ringSetA.getAtomContainerCount()-1); - atom.setProperty("RING_SIZE", new Integer(sring.getRingSize())); + atom.setProperty("RING_SIZE", Integer.valueOf(sring.getRingSize())); isInHeteroRing = false; Iterator containers = RingSetManipulator.getAllAtomContainers(ringSetA).iterator(); while (!isInHeteroRing && containers.hasNext()) { @@ -429,9 +435,9 @@ if (j == 0) { //csp3 if (atom.getFlag(CDKConstants.ISINRING)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(3))) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) { ID=ids[21]; - }else if (atom.getProperty("RING_SIZE").equals(new Integer(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) { + }else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) { ID=ids[1]; }else if (atom.getFlag(CDKConstants.ISAROMATIC)){ ID=ids[1]; @@ -440,8 +446,8 @@ } else if (j == 1) { //csp2 if (atom.getFlag(CDKConstants.ISINRING)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) { - }else if (atom.getProperty("RING_SIZE").equals(new Integer(3))) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) { + }else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) { ID=ids[37]; }else{ ID=ids[1]; @@ -457,10 +463,10 @@ } else if (j == 5) { //OH/Ether if (atom.getFlag(CDKConstants.ISINRING)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(3))) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) { ID=ids[48]; //EPOXY - }else if (atom.getProperty("RING_SIZE").equals(new Integer(5)) & atom.getFlag(CDKConstants.ISAROMATIC)){ + }else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5)) & atom.getFlag(CDKConstants.ISAROMATIC)){ ID=ids[40]; }else{ ID=ids[5]; @@ -469,7 +475,7 @@ } else if (j == 7) { //n sp3 if (atom.getFlag(CDKConstants.ISINRING) & atom.getFlag(CDKConstants.ISAROMATIC)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(5))) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))) { ID=ids[39]; } } @@ -482,7 +488,7 @@ } else if (j == 8) { //nsp2 if (atom.getFlag(CDKConstants.ISINRING)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(6))) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))) { ID=ids[36]; } } @@ -555,7 +561,7 @@ */ public org.openscience.cdk.interfaces.IAtom configureMMFF94BasedAtom(org.openscience.cdk.interfaces.IAtom atom, String hoseCode, boolean isInHetRing) throws Exception { //logger.debug("****** Configure MMFF94 AtomType ******"); - Vector atomTypePattern = null; + List atomTypePattern = null; MMFF94BasedAtomTypePattern atp = new MMFF94BasedAtomTypePattern(); atomTypePattern = atp.getAtomTypePatterns(); Pattern p = null; @@ -582,31 +588,31 @@ } for (int j = 0; j < atomTypePattern.size(); j++) { - p = (Pattern) atomTypePattern.elementAt(j); + p = (Pattern) atomTypePattern.get(j); mat = p.matcher(hoseCode); if (mat.matches()) { ID = ids[j]; if (j == 0) {//csp3 if (atom.getFlag(CDKConstants.ISINRING)) { - p = (Pattern) atomTypePattern.elementAt(13);//c beta heteroaromatic ring + p = (Pattern) atomTypePattern.get(13);//c beta heteroaromatic ring mat = p.matcher(hoseCode); - p2 = (Pattern) atomTypePattern.elementAt(12);//c alpha heteroaromatic ring + p2 = (Pattern) atomTypePattern.get(12);//c alpha heteroaromatic ring mat2 = p2.matcher(hoseCode); - if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[13]; - }else if (mat2.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + }else if (mat2.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[12]; - }else if (atom.getProperty("RING_SIZE").equals(new Integer(3))& !atom.getFlag(CDKConstants.ISAROMATIC)) { + }else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))& !atom.getFlag(CDKConstants.ISAROMATIC)) { ID = ids[9];//sp3 3mem rings - }else if (atom.getProperty("RING_SIZE").equals(new Integer(4)) & !atom.getFlag(CDKConstants.ISAROMATIC)) { + }else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(4)) & !atom.getFlag(CDKConstants.ISAROMATIC)) { ID = ids[8];//sp3 4mem rings - }else if (atom.getFlag(CDKConstants.ISAROMATIC) && isInHetRing && atom.getProperty("RING_SIZE").equals(new Integer(5))) { + }else if (atom.getFlag(CDKConstants.ISAROMATIC) && isInHetRing && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))) { ID = ids[14];//C in het 5 ring }else if (atom.getFlag(CDKConstants.ISAROMATIC)) { ID = ids[11];//C in benzene, pyroll } }else{ - p = (Pattern) atomTypePattern.elementAt(66);//S=C + p = (Pattern) atomTypePattern.get(66);//S=C mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[66]; @@ -614,7 +620,7 @@ } } else if (j == 1) {//csp2 if (atom.getFlag(CDKConstants.ISINRING)) { - if (atom.getProperty("RING_SIZE").equals(new Integer(4)) & !atom.getFlag(CDKConstants.ISAROMATIC) && !isInHetRing) { + if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(4)) & !atom.getFlag(CDKConstants.ISAROMATIC) && !isInHetRing) { ID = ids[29];//C= in 4 ring } } @@ -626,68 +632,68 @@ } else if (j == 36) {//n sp3 //Amid - p = (Pattern) atomTypePattern.elementAt(48); + p = (Pattern) atomTypePattern.get(48); mat = p.matcher(hoseCode); if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) { ID = ids[48]; } - p = (Pattern) atomTypePattern.elementAt(44);//sp3 n-oxide + p = (Pattern) atomTypePattern.get(44);//sp3 n-oxide mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[44]; } - p = (Pattern) atomTypePattern.elementAt(56);//npyd + p = (Pattern) atomTypePattern.get(56);//npyd mat = p.matcher(hoseCode); - if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc... if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ - if(atom.getProperty("RING_SIZE").equals(new Integer(6)) && mat.matches()){ + if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc... if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ + if(atom.getProperty("RING_SIZE").equals(Integer.valueOf(6)) && mat.matches()){ ID = ids[56]; - }else if(atom.getProperty("RING_SIZE").equals(new Integer(5)) && mat.matches()){ + }else if(atom.getProperty("RING_SIZE").equals(Integer.valueOf(5)) && mat.matches()){ ID = ids[57]; }else{ ID=ids[64]; } } - p = (Pattern) atomTypePattern.elementAt(61);//npyd + p = (Pattern) atomTypePattern.get(61);//npyd mat = p.matcher(hoseCode); - if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc... if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ - if(atom.getProperty("RING_SIZE").equals(new Integer(6)) && mat.matches()){ + if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc... if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ + if(atom.getProperty("RING_SIZE").equals(Integer.valueOf(6)) && mat.matches()){ ID = ids[61]; - }else if(atom.getProperty("RING_SIZE").equals(new Integer(5)) && mat.matches()){ + }else if(atom.getProperty("RING_SIZE").equals(Integer.valueOf(5)) && mat.matches()){ ID = ids[62]; }else{ ID=ids[43]; } } - p = (Pattern) atomTypePattern.elementAt(45);//NC#N + p = (Pattern) atomTypePattern.get(45);//NC#N mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[45]; } }else if (j == 37) {//N=C n in imine - p = (Pattern) atomTypePattern.elementAt(59);//n beta heteroaromatic ring + p = (Pattern) atomTypePattern.get(59);//n beta heteroaromatic ring mat = p.matcher(hoseCode); if (atom.getFlag(CDKConstants.ISINRING)) { - if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[59]; - }else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(6))){ + }else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))){ ID = ids[56]; - }else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + }else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[57]; } } - p = (Pattern) atomTypePattern.elementAt(43);//N2OX + p = (Pattern) atomTypePattern.get(43);//N2OX mat = p.matcher(hoseCode); if (mat.matches()){ - if (atom.getFlag(CDKConstants.ISAROMATIC)&& atom.getProperty("RING_SIZE").equals(new Integer(6))){ + if (atom.getFlag(CDKConstants.ISAROMATIC)&& atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))){ ID = ids[61];//npox - }else if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + }else if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[62];//n5ox }else{ ID = ids[43]; @@ -696,44 +702,44 @@ }else if (j==43){//sp2 n oxide if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[62]; }else if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(6))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))){ ID = ids[61]; } }else if (j==40 || j==41){//n in c=n=n or terminal n in azido if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[59];//aromatic N 5R alpha } }else if (j==50){//n+= if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[63];//n5+ }else if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(6))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))){ ID = ids[58];//npd+ } }else if (j==28){//O ->furan if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC) - && atom.getProperty("RING_SIZE").equals(new Integer(5))){ + && atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))){ ID = ids[35]; } }else if (j==16){//H-Object-> enol - p = (Pattern) atomTypePattern.elementAt(21);//enol + p = (Pattern) atomTypePattern.get(21);//enol mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[21]; } - p = (Pattern) atomTypePattern.elementAt(18);//enol + p = (Pattern) atomTypePattern.get(18);//enol mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[18]; } }else if (j==74){//P - p = (Pattern) atomTypePattern.elementAt(75);//-P=C + p = (Pattern) atomTypePattern.get(75);//-P=C mat = p.matcher(hoseCode); if (mat.matches()){ ID = ids[75]; Modified: cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java =================================================================== --- cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java 2008-09-07 08:13:38 UTC (rev 12215) +++ cdk/trunk/src/main/org/openscience/cdk/modeling/builder3d/MM2BasedParameterSetReader.java 2008-09-07 08:25:34 UTC (rev 12216) @@ -34,11 +34,13 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.Hashtable; +import java.util.List; +import java.util.Map; import java.util.StringTokenizer; import java.util.Vector; import org.openscience.cdk.AtomType; -import org.openscience.cdk.tools.LoggingTool; +import org.openscience.cdk.interfaces.IAtomType; /** * AtomType list configurator that uses the ParameterSet originally @@ -57,28 +59,28 @@ private String configFile = "org/openscience/cdk/modeling/forcefield/data/mm2.prm"; private InputStream ins = null; - private Hashtable parameterSet; - private Vector atomTypes; + private Map parameterSet; + private List<IAtomType> atomTypes; private StringTokenizer st; private String key = ""; /** - *Constructor for the MM2BasedParameterSetReader object + * Constructor for the MM2BasedParameterSetReader object. */ public MM2BasedParameterSetReader() { parameterSet = new Hashtable(); - atomTypes = new Vector(); + atomTypes = new Vector<IAtomType>(); } - public Hashtable getParamterSet(){ + public Map getParamterSet(){ return parameterSet; } - public Vector getAtomTypes(){ + public List<IAtomType> getAtomTypes(){ return atomTypes; } /** - * Sets the file containing the config data + * Sets the file containing the config data. * * @param ins The new inputStream type InputStream */ @@ -288,7 +290,7 @@ "Malformed Number"); } - AtomType atomType = new AtomType(name, rootType); + IAtomType atomType = new AtomType(name, rootType); atomType.setAtomicNumber(an); atomType.setExactMass(mass); atomType.setFormalNeighbourCount(maxbond); @@ -296,7 +298,7 @@ Color co = new Color(rl, gl, bl); atomType.setProperty("org.openscience.cdk.renderer.color", co); atomType.setAtomTypeName(sid); - atomTypes.addElement(atomType); + atomTypes.add(atomType); } /** @@ -305,7 +307,7 @@ * @exception Exception Description of the Exception */ private void setvdWaals() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid = st.nextToken(); String sradius = st.nextToken(); @@ -331,7 +333,7 @@ * @exception Exception Description of the Exception */ private void setvdWaalpr() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -356,7 +358,7 @@ * @exception Exception Description of the Exception */ private void setBond() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -382,7 +384,7 @@ * @exception Exception Description of the Exception */ private void setBond3() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -408,7 +410,7 @@ * @exception Exception Description of the Exception */ private void setBond4() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -434,7 +436,7 @@ * @exception Exception Description of the Exception */ private void setAngle() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -476,7 +478,7 @@ * @exception Exception Description of the Exception */ private void setAngle3() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -509,7 +511,7 @@ * @exception Exception Description of the Exception */ private void setAngle4() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -542,7 +544,7 @@ * @exception Exception Description of the Exception */ private void setStrBnd() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String value1 = st.nextToken(); @@ -563,7 +565,7 @@ * @exception Exception Description of the Exception */ private void setOpBend() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -592,7 +594,7 @@ * @exception Exception Description of the Exception */ private void setTorsion() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid2 = st.nextToken(); @@ -636,7 +638,7 @@ * @exception Exception Description of the Exception */ private void setTorsion4() throws Exception { - Vector data = new Vector(); + List data = new Vector(); st.nextToken(); String sid1 = st.nextToken(); String sid... [truncated message content] |