Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replaced more IMolecule by IAtomContainer, fixing more unit test regr…

…essions

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information...
commit 611aaca5e9d8bc07920104bd3693da214883501d 1 parent 664a14c
Egon Willighagen egonw authored rajarshi committed
18 src/main/org/openscience/cdk/tools/IonizationPotentialTool.java
View
@@ -36,7 +36,6 @@
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IReactionSet;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.reaction.IReactionProcess;
@@ -182,7 +181,7 @@ private static boolean familyBond(IAtomContainer container, IBond bond) {
return false;
StructureResonanceGenerator gRN = new StructureResonanceGenerator();
- IAtomContainer ac = gRN.getContainer((IMolecule) container, bond);
+ IAtomContainer ac = gRN.getContainer(container, bond);
if(ac == null)
return true;
@@ -268,7 +267,7 @@ private static int getDoubleBondNumber(IAtomContainer container) {
else
results[5] = 0.0;
// numberResonance
- IAtomContainer acR = gRI.getContainer(asMolecule(container), atom);
+ IAtomContainer acR = gRI.getContainer(container, atom);
if(acR != null){
results[6] = acR.getAtomCount();
// numberAromaticAtoms
@@ -347,7 +346,7 @@ private static int getDoubleBondNumber(IAtomContainer container) {
else
results[5] += 0.0;
// numberResonance
- IAtomContainer acR = gRI.getContainer((IMolecule) container, atom);
+ IAtomContainer acR = gRI.getContainer(container, atom);
if(acR != null){
results[6] += acR.getAtomCount();
// numberAromaticAtoms
@@ -484,7 +483,7 @@ private static IAtomContainer initiateIonization(IAtomContainer container,
IReactionProcess reactionNBE = new ElectronImpactNBEReaction();
IAtomContainerSet setOfReactants = container.getBuilder().newInstance(IAtomContainerSet.class);
- setOfReactants.addAtomContainer(asMolecule(container));
+ setOfReactants.addAtomContainer(container);
atom.setFlag(CDKConstants.REACTIVE_CENTER,true);
List<IParameterReact> paramList = new ArrayList<IParameterReact>();
@@ -503,13 +502,4 @@ private static IAtomContainer initiateIonization(IAtomContainer container,
return null;
}
- private static IMolecule asMolecule(IAtomContainer container) {
- if (container instanceof IMolecule)
- return (IMolecule) container;
-
- return container.getBuilder().newInstance(
- IMolecule.class, container
- );
- }
-
}
12 src/main/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
View
@@ -1,9 +1,4 @@
-/* $RCSfile$
- * $Author$
- * $Date$
- * $Revision$
- *
- * Copyright (C) 2003-2007 The Chemistry Development Kit (CDK) project
+/* Copyright (C) 2003-2007 The Chemistry Development Kit (CDK) project
*
* Contact: cdk-devel@lists.sourceforge.net
*
@@ -49,7 +44,6 @@
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IMolecularFormula;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IPseudoAtom;
import org.openscience.cdk.interfaces.IStereoElement;
@@ -361,7 +355,7 @@ public static IAtomContainer removeHydrogens(IAtomContainer atomContainer)
List<IAtom> remove = new ArrayList<IAtom>(); // lists removed Hs.
// Clone atoms except those to be removed.
- IMolecule mol = atomContainer.getBuilder().newInstance(IMolecule.class);
+ IAtomContainer mol = atomContainer.getBuilder().newInstance(IAtomContainer.class);
int count = atomContainer.getAtomCount();
for (int i = 0;
i < count;
@@ -489,7 +483,7 @@ private static IAtomContainer removeHydrogens(IAtomContainer ac, List<IAtom> pre
// lists removed Hs.
// Clone atoms except those to be removed.
- IMolecule mol = ac.getBuilder().newInstance(IMolecule.class);
+ IAtomContainer mol = ac.getBuilder().newInstance(IAtomContainer.class);
int count = ac.getAtomCount();
for (int i = 0;
i < count;
7 src/test/org/openscience/cdk/qsar/descriptors/atomic/IPAtomicLearningDescriptorTest.java
View
@@ -29,7 +29,6 @@
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.IAtomicDescriptor;
import org.openscience.cdk.qsar.result.DoubleResult;
import org.openscience.cdk.silent.SilentChemObjectBuilder;
@@ -76,7 +75,7 @@ public void testIPAtomicLearningDescriptor() throws Exception {
@Test
public void testIPDescriptor0() throws ClassNotFoundException, CDKException, java.lang.Exception{
- IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtomContainer mol = builder.newInstance(IAtomContainer.class);
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -107,7 +106,7 @@ public void testIPDescriptor0() throws ClassNotFoundException, CDKException, jav
@Test
public void testIPDescriptor1() throws Exception{
- IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtomContainer mol = builder.newInstance(IAtomContainer.class);
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -542,7 +541,7 @@ public void testIPPySystemWithHeteroatomDescriptor1() throws Exception{
@Test
public void testFluorobenzene() throws Exception {
- IMolecule molecule = builder.newInstance(IMolecule.class);
+ IAtomContainer molecule = builder.newInstance(IAtomContainer.class);
molecule.addAtom(builder.newInstance(IAtom.class,"F"));
molecule.addAtom(builder.newInstance(IAtom.class,"C"));
molecule.addBond(0, 1, IBond.Order.SINGLE);
3  src/test/org/openscience/cdk/qsar/descriptors/molecular/BasicGroupCountDescriptorTest.java
View
@@ -25,7 +25,6 @@
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.IntegerResult;
import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.smiles.SmilesParser;
@@ -59,7 +58,7 @@ public void setUp() throws Exception {
*/
@Test public void test() throws Exception {
IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
- IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtomContainer mol = builder.newInstance(IAtomContainer.class);
IAtom a1 = builder.newInstance(IAtom.class,"N");
mol.addAtom(a1);
IAtom a2 = builder.newInstance(IAtom.class,"N");
5 src/test/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularLearningDescriptorTest.java
View
@@ -30,7 +30,6 @@
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
import org.openscience.cdk.qsar.result.DoubleResult;
import org.openscience.cdk.silent.SilentChemObjectBuilder;
@@ -75,7 +74,7 @@ public void testIPMolecularLearningDescriptor() throws Exception {
*/
@Test public void testIPDescriptor0() throws Exception{
- IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtomContainer mol = builder.newInstance(IAtomContainer.class);
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addAtom(builder.newInstance(IAtom.class,"C"));
mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -249,7 +248,7 @@ public void testIPMolecularLearningDescriptor() throws Exception {
*/
@Test
public void testBug_2787332_triclosan() throws Exception {
- IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtomContainer mol = builder.newInstance(IAtomContainer.class);
mol.addAtom(builder.newInstance(IAtom.class,"C"));//0
mol.addAtom(builder.newInstance(IAtom.class,"C"));//1
mol.addAtom(builder.newInstance(IAtom.class,"C"));//2
Please sign in to comment.
Something went wrong with that request. Please try again.