From: <raj...@us...> - 2006-12-20 21:04:55
|
Revision: 7539 http://svn.sourceforge.net/cdk/?rev=7539&view=rev Author: rajarshi Date: 2006-12-20 12:58:28 -0800 (Wed, 20 Dec 2006) Log Message: ----------- fixed some deprecated code Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java trunk/cdk/src/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java Modified: trunk/cdk/src/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java 2006-12-20 20:49:18 UTC (rev 7538) +++ trunk/cdk/src/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java 2006-12-20 20:58:28 UTC (rev 7539) @@ -23,20 +23,20 @@ */ package org.openscience.cdk.modeling.builder3d; -import java.util.Hashtable; -import java.util.Vector; - -import javax.vecmath.Point2d; -import javax.vecmath.Point3d; -import javax.vecmath.Vector3d; - import org.openscience.cdk.CDKConstants; import org.openscience.cdk.geometry.GeometryToolsInternalCoordinates; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; +import javax.vecmath.Point2d; +import javax.vecmath.Point3d; +import javax.vecmath.Vector3d; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Vector; + /** * Place aliphatic chains with Z matrix method. * @@ -356,9 +356,9 @@ * author: steinbeck,cho */ public IAtom getNextUnplacedHeavyAtomWithAliphaticPlacedNeighbour(IAtomContainer molecule) { - org.openscience.cdk.interfaces.IBond[] bonds = molecule.getBonds(); - for (int i = 0; i < bonds.length; i++) { - IBond bond = bonds[i]; + Iterator bonds = molecule.bonds(); + while (bonds.hasNext()) { + IBond bond = (IBond) bonds.next(); if (bond.getAtom(0).getFlag(CDKConstants.ISPLACED) & !(bond.getAtom(1).getFlag(CDKConstants.ISPLACED))) { if (bond.getAtom(1).getFlag(CDKConstants.ISALIPHATIC) & !bond.getAtom(1).getSymbol().equals("H")) { return bond.getAtom(1); @@ -380,9 +380,9 @@ * author: steinbeck,cho */ public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour(IAtomContainer molecule) { - org.openscience.cdk.interfaces.IBond[] bonds = molecule.getBonds(); - for (int i = 0; i < bonds.length; i++) { - IBond bond = bonds[i]; + Iterator bonds = molecule.bonds(); + while (bonds.hasNext()) { + IBond bond = (IBond) bonds.next(); IAtom atom0 = bond.getAtom(0); IAtom atom1 = bond.getAtom(1); if (atom0.getFlag(CDKConstants.ISPLACED) & !(atom1.getFlag(CDKConstants.ISPLACED))) { @@ -405,9 +405,10 @@ * @return The nextPlacedHeavyAtomWithUnplacedRingNeighbour value */ public IAtom getNextPlacedHeavyAtomWithUnplacedRingNeighbour(IAtomContainer molecule) { - org.openscience.cdk.interfaces.IBond[] bonds = molecule.getBonds(); - for (int i = 0; i < bonds.length; i++) { - IBond bond = bonds[i]; +// IBond[] bonds = molecule.getBonds(); + Iterator bonds = molecule.bonds(); + while (bonds.hasNext()) { + IBond bond = (IBond) bonds.next(); IAtom atom0 = bond.getAtom(0); IAtom atom1 = bond.getAtom(1); if (atom0.getFlag(CDKConstants.ISPLACED) & !(atom1.getFlag(CDKConstants.ISPLACED))) { Modified: trunk/cdk/src/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java 2006-12-20 20:49:18 UTC (rev 7538) +++ trunk/cdk/src/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java 2006-12-20 20:58:28 UTC (rev 7539) @@ -28,29 +28,23 @@ */ package org.openscience.cdk.modeling.builder3d; -import java.io.InputStream; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.NoSuchAtomTypeException; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.interfaces.IMolecule; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.interfaces.IPseudoAtom; -import org.openscience.cdk.interfaces.IRing; -import org.openscience.cdk.interfaces.IRingSet; +import org.openscience.cdk.interfaces.*; import org.openscience.cdk.ringsearch.SSSRFinder; import org.openscience.cdk.tools.HOSECodeGenerator; import org.openscience.cdk.tools.manipulator.RingSetManipulator; +import java.io.InputStream; +import java.util.Hashtable; +import java.util.Iterator; +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 @@ -295,27 +289,31 @@ } } - IBond[] bond = molecule.getBonds(); +// IBond[] bond = molecule.getBonds(); String bondType; - for (int i=0; i < bond.length; i++) { + Iterator bonds = molecule.bonds(); + while (bonds.hasNext()) { + IBond bond = (IBond) bonds.next(); + //System.out.println("bond[" + i + "] properties : " + molecule.getBond(i).getProperties()); bondType = "0"; - if (bond[i].getOrder() == 1) { - if ((bond[i].getAtom(0).getAtomTypeName().equals("Csp2")) & - ((bond[i].getAtom(1).getAtomTypeName().equals("Csp2")) | (bond[i].getAtom(1).getAtomTypeName().equals("C=")))) { + if (bond.getOrder() == 1) { + if ((bond.getAtom(0).getAtomTypeName().equals("Csp2")) & + ((bond.getAtom(1).getAtomTypeName().equals("Csp2")) | (bond.getAtom(1).getAtomTypeName().equals("C=")))) { bondType = "1"; } - if ((bond[i].getAtom(0).getAtomTypeName().equals("C=")) & - ((bond[i].getAtom(1).getAtomTypeName().equals("Csp2")) | (bond[i].getAtom(1).getAtomTypeName().equals("C=")))) { + if ((bond.getAtom(0).getAtomTypeName().equals("C=")) & + ((bond.getAtom(1).getAtomTypeName().equals("Csp2")) | (bond.getAtom(1).getAtomTypeName().equals("C=")))) { bondType = "1";} - if ((bond[i].getAtom(0).getAtomTypeName().equals("Csp")) & - (bond[i].getAtom(1).getAtomTypeName().equals("Csp"))) { + if ((bond.getAtom(0).getAtomTypeName().equals("Csp")) & + (bond.getAtom(1).getAtomTypeName().equals("Csp"))) { bondType = "1";} } - molecule.getBond(i).setProperty("MMFF94 bond type", bondType); - //System.out.println("bond[" + i + "] properties : " + molecule.getBond(i).getProperties()); +// molecule.getBond(i).setProperty("MMFF94 bond type", bondType); + bond.setProperty("MMFF94 bond type", bondType); + //System.out.println("bond[" + i + "] properties : " + molecule.getBond(i).getProperties()); } return ringSetMolecule; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |