Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
@@ -36,7 +36,6 @@
36 36 import org.openscience.cdk.interfaces.IAtomContainer;
37 37 import org.openscience.cdk.interfaces.IAtomContainerSet;
38 38 import org.openscience.cdk.interfaces.IBond;
39   -import org.openscience.cdk.interfaces.IMolecule;
40 39 import org.openscience.cdk.interfaces.IReactionSet;
41 40 import org.openscience.cdk.interfaces.IRingSet;
42 41 import org.openscience.cdk.reaction.IReactionProcess;
@@ -182,7 +181,7 @@ private static boolean familyBond(IAtomContainer container, IBond bond) {
182 181 return false;
183 182
184 183 StructureResonanceGenerator gRN = new StructureResonanceGenerator();
185   - IAtomContainer ac = gRN.getContainer((IMolecule) container, bond);
  184 + IAtomContainer ac = gRN.getContainer(container, bond);
186 185
187 186 if(ac == null)
188 187 return true;
@@ -268,7 +267,7 @@ private static int getDoubleBondNumber(IAtomContainer container) {
268 267 else
269 268 results[5] = 0.0;
270 269 // numberResonance
271   - IAtomContainer acR = gRI.getContainer(asMolecule(container), atom);
  270 + IAtomContainer acR = gRI.getContainer(container, atom);
272 271 if(acR != null){
273 272 results[6] = acR.getAtomCount();
274 273 // numberAromaticAtoms
@@ -347,7 +346,7 @@ private static int getDoubleBondNumber(IAtomContainer container) {
347 346 else
348 347 results[5] += 0.0;
349 348 // numberResonance
350   - IAtomContainer acR = gRI.getContainer((IMolecule) container, atom);
  349 + IAtomContainer acR = gRI.getContainer(container, atom);
351 350 if(acR != null){
352 351 results[6] += acR.getAtomCount();
353 352 // numberAromaticAtoms
@@ -484,7 +483,7 @@ private static IAtomContainer initiateIonization(IAtomContainer container,
484 483 IReactionProcess reactionNBE = new ElectronImpactNBEReaction();
485 484
486 485 IAtomContainerSet setOfReactants = container.getBuilder().newInstance(IAtomContainerSet.class);
487   - setOfReactants.addAtomContainer(asMolecule(container));
  486 + setOfReactants.addAtomContainer(container);
488 487
489 488 atom.setFlag(CDKConstants.REACTIVE_CENTER,true);
490 489 List<IParameterReact> paramList = new ArrayList<IParameterReact>();
@@ -503,13 +502,4 @@ private static IAtomContainer initiateIonization(IAtomContainer container,
503 502 return null;
504 503 }
505 504
506   - private static IMolecule asMolecule(IAtomContainer container) {
507   - if (container instanceof IMolecule)
508   - return (IMolecule) container;
509   -
510   - return container.getBuilder().newInstance(
511   - IMolecule.class, container
512   - );
513   - }
514   -
515 505 }
12 src/main/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
... ... @@ -1,9 +1,4 @@
1   -/* $RCSfile$
2   - * $Author$
3   - * $Date$
4   - * $Revision$
5   - *
6   - * Copyright (C) 2003-2007 The Chemistry Development Kit (CDK) project
  1 +/* Copyright (C) 2003-2007 The Chemistry Development Kit (CDK) project
7 2 *
8 3 * Contact: cdk-devel@lists.sourceforge.net
9 4 *
@@ -49,7 +44,6 @@
49 44 import org.openscience.cdk.interfaces.IElement;
50 45 import org.openscience.cdk.interfaces.ILonePair;
51 46 import org.openscience.cdk.interfaces.IMolecularFormula;
52   -import org.openscience.cdk.interfaces.IMolecule;
53 47 import org.openscience.cdk.interfaces.IPseudoAtom;
54 48 import org.openscience.cdk.interfaces.IStereoElement;
55 49
@@ -361,7 +355,7 @@ public static IAtomContainer removeHydrogens(IAtomContainer atomContainer)
361 355 List<IAtom> remove = new ArrayList<IAtom>(); // lists removed Hs.
362 356
363 357 // Clone atoms except those to be removed.
364   - IMolecule mol = atomContainer.getBuilder().newInstance(IMolecule.class);
  358 + IAtomContainer mol = atomContainer.getBuilder().newInstance(IAtomContainer.class);
365 359 int count = atomContainer.getAtomCount();
366 360 for (int i = 0;
367 361 i < count;
@@ -489,7 +483,7 @@ private static IAtomContainer removeHydrogens(IAtomContainer ac, List<IAtom> pre
489 483 // lists removed Hs.
490 484
491 485 // Clone atoms except those to be removed.
492   - IMolecule mol = ac.getBuilder().newInstance(IMolecule.class);
  486 + IAtomContainer mol = ac.getBuilder().newInstance(IAtomContainer.class);
493 487 int count = ac.getAtomCount();
494 488 for (int i = 0;
495 489 i < count;
7 src/test/org/openscience/cdk/qsar/descriptors/atomic/IPAtomicLearningDescriptorTest.java
@@ -29,7 +29,6 @@
29 29 import org.openscience.cdk.interfaces.IAtomContainer;
30 30 import org.openscience.cdk.interfaces.IBond;
31 31 import org.openscience.cdk.interfaces.IChemObjectBuilder;
32   -import org.openscience.cdk.interfaces.IMolecule;
33 32 import org.openscience.cdk.qsar.IAtomicDescriptor;
34 33 import org.openscience.cdk.qsar.result.DoubleResult;
35 34 import org.openscience.cdk.silent.SilentChemObjectBuilder;
@@ -76,7 +75,7 @@ public void testIPAtomicLearningDescriptor() throws Exception {
76 75 @Test
77 76 public void testIPDescriptor0() throws ClassNotFoundException, CDKException, java.lang.Exception{
78 77
79   - IMolecule mol = builder.newInstance(IMolecule.class);
  78 + IAtomContainer mol = builder.newInstance(IAtomContainer.class);
80 79 mol.addAtom(builder.newInstance(IAtom.class,"C"));
81 80 mol.addAtom(builder.newInstance(IAtom.class,"C"));
82 81 mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -107,7 +106,7 @@ public void testIPDescriptor0() throws ClassNotFoundException, CDKException, jav
107 106 @Test
108 107 public void testIPDescriptor1() throws Exception{
109 108
110   - IMolecule mol = builder.newInstance(IMolecule.class);
  109 + IAtomContainer mol = builder.newInstance(IAtomContainer.class);
111 110 mol.addAtom(builder.newInstance(IAtom.class,"C"));
112 111 mol.addAtom(builder.newInstance(IAtom.class,"C"));
113 112 mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -542,7 +541,7 @@ public void testIPPySystemWithHeteroatomDescriptor1() throws Exception{
542 541 @Test
543 542 public void testFluorobenzene() throws Exception {
544 543
545   - IMolecule molecule = builder.newInstance(IMolecule.class);
  544 + IAtomContainer molecule = builder.newInstance(IAtomContainer.class);
546 545 molecule.addAtom(builder.newInstance(IAtom.class,"F"));
547 546 molecule.addAtom(builder.newInstance(IAtom.class,"C"));
548 547 molecule.addBond(0, 1, IBond.Order.SINGLE);
3  src/test/org/openscience/cdk/qsar/descriptors/molecular/BasicGroupCountDescriptorTest.java
@@ -25,7 +25,6 @@
25 25 import org.openscience.cdk.interfaces.IAtomContainer;
26 26 import org.openscience.cdk.interfaces.IBond;
27 27 import org.openscience.cdk.interfaces.IChemObjectBuilder;
28   -import org.openscience.cdk.interfaces.IMolecule;
29 28 import org.openscience.cdk.qsar.result.IntegerResult;
30 29 import org.openscience.cdk.silent.SilentChemObjectBuilder;
31 30 import org.openscience.cdk.smiles.SmilesParser;
@@ -59,7 +58,7 @@ public void setUp() throws Exception {
59 58 */
60 59 @Test public void test() throws Exception {
61 60 IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
62   - IMolecule mol = builder.newInstance(IMolecule.class);
  61 + IAtomContainer mol = builder.newInstance(IAtomContainer.class);
63 62 IAtom a1 = builder.newInstance(IAtom.class,"N");
64 63 mol.addAtom(a1);
65 64 IAtom a2 = builder.newInstance(IAtom.class,"N");
5 src/test/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularLearningDescriptorTest.java
@@ -30,7 +30,6 @@
30 30 import org.openscience.cdk.interfaces.IBond;
31 31 import org.openscience.cdk.interfaces.IBond.Order;
32 32 import org.openscience.cdk.interfaces.IChemObjectBuilder;
33   -import org.openscience.cdk.interfaces.IMolecule;
34 33 import org.openscience.cdk.qsar.result.DoubleArrayResult;
35 34 import org.openscience.cdk.qsar.result.DoubleResult;
36 35 import org.openscience.cdk.silent.SilentChemObjectBuilder;
@@ -75,7 +74,7 @@ public void testIPMolecularLearningDescriptor() throws Exception {
75 74 */
76 75 @Test public void testIPDescriptor0() throws Exception{
77 76
78   - IMolecule mol = builder.newInstance(IMolecule.class);
  77 + IAtomContainer mol = builder.newInstance(IAtomContainer.class);
79 78 mol.addAtom(builder.newInstance(IAtom.class,"C"));
80 79 mol.addAtom(builder.newInstance(IAtom.class,"C"));
81 80 mol.addBond(0, 1, IBond.Order.SINGLE);
@@ -249,7 +248,7 @@ public void testIPMolecularLearningDescriptor() throws Exception {
249 248 */
250 249 @Test
251 250 public void testBug_2787332_triclosan() throws Exception {
252   - IMolecule mol = builder.newInstance(IMolecule.class);
  251 + IAtomContainer mol = builder.newInstance(IAtomContainer.class);
253 252 mol.addAtom(builder.newInstance(IAtom.class,"C"));//0
254 253 mol.addAtom(builder.newInstance(IAtom.class,"C"));//1
255 254 mol.addAtom(builder.newInstance(IAtom.class,"C"));//2

0 comments on commit 611aaca

Please sign in to comment.
Something went wrong with that request. Please try again.