Permalink
Browse files

Allow IChemModels to contain IAtomContainerSets (addresses #2784940)

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information...
1 parent 6ff1f78 commit 4cc5ff85ce11f3379e82e69c35edc549af2b213f @egonw egonw committed with rajarshi Sep 25, 2011
Showing with 581 additions and 525 deletions.
  1. +11 −5 src/main/org/openscience/cdk/ChemModel.java
  2. +4 −4 src/main/org/openscience/cdk/debug/DebugChemModel.java
  3. +7 −12 src/main/org/openscience/cdk/interfaces/IChemModel.java
  4. +3 −2 src/main/org/openscience/cdk/io/Gaussian03Reader.java
  5. +3 −2 src/main/org/openscience/cdk/io/Gaussian98Reader.java
  6. +5 −3 src/main/org/openscience/cdk/io/MDLReader.java
  7. +22 −22 src/main/org/openscience/cdk/io/MDLV2000Reader.java
  8. +15 −12 src/main/org/openscience/cdk/io/Mol2Reader.java
  9. +1 −1 src/main/org/openscience/cdk/io/random/RandomAccessSDFReader.java
  10. +3 −2 src/main/org/openscience/cdk/libio/cml/Convertor.java
  11. +16 −15 src/main/org/openscience/cdk/protein/ProteinPocketFinder.java
  12. +4 −3 src/main/org/openscience/cdk/renderer/AverageBondLengthCalculator.java
  13. +3 −2 src/main/org/openscience/cdk/renderer/BoundsCalculator.java
  14. +11 −5 src/main/org/openscience/cdk/silent/ChemModel.java
  15. +6 −5 src/main/org/openscience/cdk/templates/MoleculeFactory.java
  16. +22 −6 src/main/org/openscience/cdk/tools/IDCreator.java
  17. +11 −10 src/main/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java
  18. +11 −11 src/main/org/openscience/cdk/tools/manipulator/MoleculeSetManipulator.java
  19. +3 −4 src/main/org/openscience/cdk/validate/AbstractValidator.java
  20. +3 −4 src/main/org/openscience/cdk/validate/IValidator.java
  21. +5 −5 src/main/org/openscience/cdk/validate/ValidatorEngine.java
  22. +19 −18 src/test/org/openscience/cdk/geometry/BondToolsTest.java
  23. +3 −3 src/test/org/openscience/cdk/graph/SpanningTreeTest.java
  24. +16 −16 src/test/org/openscience/cdk/graph/invariant/ConjugatedPiSystemsDetectorTest.java
  25. +2 −2 src/test/org/openscience/cdk/interfaces/AbstractChemModelTest.java
  26. +2 −2 src/test/org/openscience/cdk/io/CTXReaderTest.java
  27. +8 −6 src/test/org/openscience/cdk/io/GhemicalReaderTest.java
  28. +12 −11 src/test/org/openscience/cdk/io/HINReaderTest.java
  29. +9 −7 src/test/org/openscience/cdk/io/INChIPlainTextReaderTest.java
  30. +4 −2 src/test/org/openscience/cdk/io/INChIReaderTest.java
  31. +4 −4 src/test/org/openscience/cdk/io/MDLReaderTest.java
  32. +10 −10 src/test/org/openscience/cdk/io/MDLV2000ReaderTest.java
  33. +12 −11 src/test/org/openscience/cdk/io/Mol2ReaderTest.java
  34. +11 −11 src/test/org/openscience/cdk/io/PDBReaderTest.java
  35. +4 −3 src/test/org/openscience/cdk/io/PDBWriterTest.java
  36. +14 −14 src/test/org/openscience/cdk/io/SDFReaderTest.java
  37. +8 −6 src/test/org/openscience/cdk/io/XYZReaderTest.java
  38. +21 −20 src/test/org/openscience/cdk/io/cml/CDKRoundTripTest.java
  39. +34 −33 src/test/org/openscience/cdk/io/cml/CML23FragmentsTest.java
  40. +9 −9 src/test/org/openscience/cdk/io/cml/CML25FragmentsTest.java
  41. +59 −59 src/test/org/openscience/cdk/io/cml/CML2Test.java
  42. +30 −29 src/test/org/openscience/cdk/io/cml/CMLFragmentsTest.java
  43. +37 −35 src/test/org/openscience/cdk/io/cml/CMLRoundTripTest.java
  44. +7 −6 src/test/org/openscience/cdk/io/cml/CMLRoundTripTool.java
  45. +7 −7 src/test/org/openscience/cdk/io/cml/JChemPaintTest.java
  46. +10 −10 src/test/org/openscience/cdk/io/cml/JmolTest.java
  47. +22 −20 src/test/org/openscience/cdk/io/cml/Jumbo46CMLFragmentsTest.java
  48. +7 −7 src/test/org/openscience/cdk/io/cml/JumboTest.java
  49. +1 −1 src/test/org/openscience/cdk/layout/HydrogenPlacerTest.java
  50. +8 −6 src/test/org/openscience/cdk/layout/StructureDiagramGeneratorTest.java
  51. +2 −2 src/test/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3RTest.java
  52. +2 −2 src/test/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GDRTest.java
  53. +2 −2 src/test/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHRTest.java
  54. +2 −2 src/test/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHR_topolTest.java
  55. +2 −2 src/test/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GSRTest.java
  56. +10 −9 src/test/org/openscience/cdk/ringsearch/AllRingsFinderTest.java
  57. +2 −3 src/test/org/openscience/cdk/smiles/SmilesGeneratorTest.java
View
16 src/main/org/openscience/cdk/ChemModel.java
@@ -24,10 +24,16 @@
package org.openscience.cdk;
-import org.openscience.cdk.interfaces.*;
-
import java.io.Serializable;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
+import org.openscience.cdk.interfaces.IChemModel;
+import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
+import org.openscience.cdk.interfaces.IChemObjectListener;
+import org.openscience.cdk.interfaces.ICrystal;
+import org.openscience.cdk.interfaces.IReactionSet;
+import org.openscience.cdk.interfaces.IRingSet;
+
/**
* An object containing multiple MoleculeSet and
* the other lower level concepts like rings, sequences,
@@ -52,7 +58,7 @@
/**
* A MoleculeSet.
*/
- protected IMoleculeSet setOfMolecules = null;
+ protected IAtomContainerSet setOfMolecules = null;
/**
* A ReactionSet.
@@ -81,7 +87,7 @@ public ChemModel() {}
*
* @see #setMoleculeSet
*/
- public IMoleculeSet getMoleculeSet()
+ public IAtomContainerSet getMoleculeSet()
{
return this.setOfMolecules;
}
@@ -94,7 +100,7 @@ public IMoleculeSet getMoleculeSet()
*
* @see #getMoleculeSet
*/
- public void setMoleculeSet(IMoleculeSet setOfMolecules)
+ public void setMoleculeSet(IAtomContainerSet setOfMolecules)
{
if (this.setOfMolecules != null)
this.setOfMolecules.removeListener(this);
View
8 src/main/org/openscience/cdk/debug/DebugChemModel.java
@@ -23,12 +23,12 @@
import java.util.Map;
import org.openscience.cdk.ChemModel;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
+import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.ICrystal;
-import org.openscience.cdk.interfaces.IMoleculeSet;
-import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IReactionSet;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.tools.ILoggingTool;
@@ -144,12 +144,12 @@ public IChemObjectBuilder getBuilder() {
return DebugChemObjectBuilder.getInstance();
}
- public IMoleculeSet getMoleculeSet() {
+ public IAtomContainerSet getMoleculeSet() {
logger.debug("Getting setOfMolecules: ", super.getMoleculeSet());
return super.getMoleculeSet();
}
- public void setMoleculeSet(IMoleculeSet setOfMolecules) {
+ public void setMoleculeSet(IAtomContainerSet setOfMolecules) {
logger.debug("Setting setOfMolecules: ", setOfMolecules);
super.setMoleculeSet(setOfMolecules);
}
View
19 src/main/org/openscience/cdk/interfaces/IChemModel.java
@@ -1,9 +1,4 @@
-/* $RCSfile$
- * $Author$
- * $Date$
- * $Revision$
- *
- * Copyright (C) 2006-2007 Egon Willighagen <egonw@users.sf.net>
+/* Copyright (C) 2006-2007,2011 Egon Willighagen <egonw@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
@@ -24,7 +19,7 @@
package org.openscience.cdk.interfaces;
/**
- * An object containig multiple MoleculeSet and
+ * An object containing multiple MoleculeSet and
* the other lower level concepts like rings, sequences,
* fragments, etc.
*
@@ -34,20 +29,20 @@
public interface IChemModel extends IChemObject {
/**
- * Returns the MoleculeSet of this ChemModel.
+ * Returns the IAtomContainerSet of this ChemModel.
*
- * @return The MoleculeSet of this ChemModel
+ * @return The {@link IAtomContainerSet} of this ChemModel
* @see #setMoleculeSet
*/
- public IMoleculeSet getMoleculeSet();
+ public IAtomContainerSet getMoleculeSet();
/**
- * Sets the MoleculeSet of this ChemModel.
+ * Sets the IAtomContainerSet of this ChemModel.
*
* @param setOfMolecules the content of this model
* @see #getMoleculeSet
*/
- public void setMoleculeSet(IMoleculeSet setOfMolecules);
+ public void setMoleculeSet(IAtomContainerSet setOfMolecules);
/**
* Returns the RingSet of this ChemModel.
View
5 src/main/org/openscience/cdk/io/Gaussian03Reader.java
@@ -35,6 +35,7 @@
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemObject;
@@ -282,8 +283,8 @@ private void readCoordinates(IChemModel model) throws CDKException, IOException
*/
private void readPartialCharges(IChemModel model) throws CDKException, IOException {
logger.info("Reading partial atomic charges");
- IMoleculeSet moleculeSet = model.getMoleculeSet();
- IMolecule molecule = moleculeSet.getMolecule(0);
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
+ IAtomContainer molecule = moleculeSet.getAtomContainer(0);
String line = input.readLine(); // skip first line after "Total atomic charges"
while (input.ready()) {
line = input.readLine();
View
5 src/main/org/openscience/cdk/io/Gaussian98Reader.java
@@ -41,6 +41,7 @@
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemObject;
@@ -355,8 +356,8 @@ private void readCoordinates(IChemModel model) throws CDKException, IOException
*/
private void readPartialCharges(IChemModel model) throws CDKException, IOException {
logger.info("Reading partial atomic charges");
- IMoleculeSet moleculeSet = model.getMoleculeSet();
- IMolecule molecule = moleculeSet.getMolecule(0);
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
+ IAtomContainer molecule = moleculeSet.getAtomContainer(0);
String line = input.readLine();
// skip first line after "Total atomic charges"
while (input.ready()) {
View
8 src/main/org/openscience/cdk/io/MDLReader.java
@@ -41,6 +41,8 @@
import org.openscience.cdk.config.IsotopeFactory;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
@@ -179,13 +181,13 @@ public boolean accepts(Class classObject) {
}
private IChemModel readChemModel(IChemModel chemModel) throws CDKException {
- IMoleculeSet setOfMolecules = chemModel.getMoleculeSet();
+ IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
if (setOfMolecules == null) {
setOfMolecules = chemModel.getBuilder().newInstance(IMoleculeSet.class);
}
- IMolecule m = readMolecule(chemModel.getBuilder().newInstance(IMolecule.class));
+ IAtomContainer m = readMolecule(chemModel.getBuilder().newInstance(IMolecule.class));
if (m != null) {
- setOfMolecules.addMolecule(m);
+ setOfMolecules.addAtomContainer(m);
}
chemModel.setMoleculeSet(setOfMolecules);
return chemModel;
View
44 src/main/org/openscience/cdk/io/MDLV2000Reader.java
@@ -23,12 +23,30 @@
*/
package org.openscience.cdk.io;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.vecmath.Point2d;
+import javax.vecmath.Point3d;
+
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.config.IsotopeFactory;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
@@ -43,30 +61,12 @@
import org.openscience.cdk.io.formats.MDLV2000Format;
import org.openscience.cdk.io.setting.BooleanIOSetting;
import org.openscience.cdk.io.setting.IOSetting;
+import org.openscience.cdk.isomorphism.matchers.CTFileQueryBond;
+import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
-import javax.vecmath.Point2d;
-import javax.vecmath.Point3d;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.openscience.cdk.interfaces.IAtomContainer;
-import org.openscience.cdk.isomorphism.matchers.CTFileQueryBond;
-import org.openscience.cdk.isomorphism.matchers.QueryAtom;
-import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer;
-
/**
* Reads content from MDL molfiles and SD files.
* It can read a {@link IMolecule} or {@link IChemModel} from an MDL molfile, and
@@ -198,13 +198,13 @@ public boolean accepts(Class<? extends IChemObject> classObject) {
}
private IChemModel readChemModel(IChemModel chemModel) throws CDKException {
- IMoleculeSet setOfMolecules = chemModel.getMoleculeSet();
+ IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
if (setOfMolecules == null) {
setOfMolecules = chemModel.getBuilder().newInstance(IMoleculeSet.class);
}
IAtomContainer m = readAtomContainer(chemModel.getBuilder().newInstance(IMolecule.class));
if (m != null && m instanceof IMolecule) {
- setOfMolecules.addMolecule((IMolecule)m);
+ setOfMolecules.addAtomContainer((IMolecule)m);
}
chemModel.setMoleculeSet(setOfMolecules);
return chemModel;
View
27 src/main/org/openscience/cdk/io/Mol2Reader.java
@@ -24,12 +24,24 @@
*/
package org.openscience.cdk.io;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.StringTokenizer;
+
+import javax.vecmath.Point3d;
+
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.config.AtomTypeFactory;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
@@ -45,15 +57,6 @@
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;
import org.openscience.cdk.tools.periodictable.PeriodicTable;
-import javax.vecmath.Point3d;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.StringTokenizer;
-
/**
* Reads a molecule from an Mol2 file, such as written by Sybyl.
* See the specs <a href="http://www.tripos.com/data/support/mol2.pdf">here</a>.
@@ -134,13 +137,13 @@ public boolean accepts(Class classObject) {
}
private IChemModel readChemModel(IChemModel chemModel) throws CDKException {
- IMoleculeSet setOfMolecules = chemModel.getMoleculeSet();
+ IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
if (setOfMolecules == null) {
setOfMolecules = chemModel.getBuilder().newInstance(IMoleculeSet.class);
}
- IMolecule m = readMolecule(chemModel.getBuilder().newInstance(IMolecule.class));
+ IAtomContainer m = readMolecule(chemModel.getBuilder().newInstance(IMolecule.class));
if (m != null) {
- setOfMolecules.addMolecule(m);
+ setOfMolecules.addAtomContainer(m);
}
chemModel.setMoleculeSet(setOfMolecules);
return chemModel;
View
2 src/main/org/openscience/cdk/io/random/RandomAccessSDFReader.java
@@ -90,7 +90,7 @@ protected IChemObject processContent() throws CDKException {
for (int i=0; i <c;i++) {
Iterator cm = ((IChemFile) co).getChemSequence(i).chemModels().iterator();
while (cm.hasNext()) {
- Iterator sm = ((IChemModel)cm.next()).getMoleculeSet().molecules().iterator();
+ Iterator sm = ((IChemModel)cm.next()).getMoleculeSet().atomContainers().iterator();
while (sm.hasNext()) {
co = (IMolecule) sm.next();
View
5 src/main/org/openscience/cdk/libio/cml/Convertor.java
@@ -38,6 +38,7 @@
import org.openscience.cdk.geometry.CrystalGeometryTools;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
@@ -309,7 +310,7 @@ public CMLMoleculeList cdkMoleculeSetToCMLList(IMoleculeSet moleculeSet) {
return cdkMoleculeSetToCMLList(moleculeSet, true);
}
- private CMLMoleculeList cdkMoleculeSetToCMLList(IMoleculeSet moleculeSet, boolean setIDs) {
+ private CMLMoleculeList cdkMoleculeSetToCMLList(IAtomContainerSet moleculeSet, boolean setIDs) {
CMLMoleculeList cmlList = new CMLMoleculeList();
cmlList.setConvention("cdk:moleculeSet");
@@ -320,7 +321,7 @@ private CMLMoleculeList cdkMoleculeSetToCMLList(IMoleculeSet moleculeSet, boolea
cmlList.setId(moleculeSet.getID());
for (int i = 0; i < moleculeSet.getAtomContainerCount(); i++) {
- IAtomContainer container = moleculeSet.getMolecule(i);
+ IAtomContainer container = moleculeSet.getAtomContainer(i);
if (container instanceof IMolecule) {
cmlList.appendChild(
cdkMoleculeToCMLMolecule((IMolecule)container, false)
View
31 src/main/org/openscience/cdk/protein/ProteinPocketFinder.java
@@ -20,15 +20,28 @@
*/
package org.openscience.cdk.protein;
+import java.io.BufferedWriter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.vecmath.Point3d;
+
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.config.AtomTypeFactory;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBioPolymer;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemObject;
import org.openscience.cdk.interfaces.IChemSequence;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.io.ISimpleChemObjectReader;
import org.openscience.cdk.io.ReaderFactory;
import org.openscience.cdk.protein.data.PDBAtom;
@@ -38,18 +51,6 @@
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
import org.openscience.cdk.tools.periodictable.PeriodicTable;
-import javax.vecmath.Point3d;
-import java.io.BufferedWriter;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
/**
* The detection of pocket and cavities in a bioPolymer is done similar to the program
* LIGSITE {@cdk.cite MH1997}.
@@ -135,8 +136,8 @@ private void readBioPolymer(String biopolymerFile) {
// Get molecule from ChemFile
IChemSequence chemSequence = chemFile.getChemSequence(0);
IChemModel chemModel = chemSequence.getChemModel(0);
- IMoleculeSet setOfMolecules = chemModel.getMoleculeSet();
- protein = (IBioPolymer) setOfMolecules.getMolecule(0);
+ IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet();
+ protein = (IBioPolymer) setOfMolecules.getAtomContainer(0);
} catch (Exception exc) {
logger.error("Could not read BioPolymer from file>"
+ biopolymerFile + " due to: " + exc.getMessage());
View
7 src/main/org/openscience/cdk/renderer/AverageBondLengthCalculator.java
@@ -23,6 +23,7 @@
import org.openscience.cdk.geometry.GeometryTools;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
@@ -75,9 +76,9 @@ public static double calculateAverageBondLength(IReaction reaction) {
* @param moleculeSet the molecule set to use
* @return the average bond length
*/
- public static double calculateAverageBondLength(IMoleculeSet moleculeSet) {
+ public static double calculateAverageBondLength(IAtomContainerSet moleculeSet) {
double averageBondModelLength = 0.0;
- for (IAtomContainer atomContainer : moleculeSet.molecules()) {
+ for (IAtomContainer atomContainer : moleculeSet.atomContainers()) {
averageBondModelLength +=
GeometryTools.getBondLengthAverage(atomContainer);
}
@@ -93,7 +94,7 @@ public static double calculateAverageBondLength(IMoleculeSet moleculeSet) {
public static double calculateAverageBondLength(IChemModel model) {
// empty models have to have a scale
- IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
if (moleculeSet == null) {
IReactionSet reactionSet = model.getReactionSet();
if (reactionSet != null) {
View
5 src/main/org/openscience/cdk/renderer/BoundsCalculator.java
@@ -28,6 +28,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
@@ -51,7 +52,7 @@
* @return the bounding rectangle of the chem model
*/
public static Rectangle2D calculateBounds(IChemModel chemModel) {
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
IReactionSet reactionSet = chemModel.getReactionSet();
Rectangle2D totalBounds = null;
if (moleculeSet != null) {
@@ -111,7 +112,7 @@ public static Rectangle2D calculateBounds(IReaction reaction) {
* @param moleculeSet the molecule set to use
* @return the bounding rectangle of the molecule set
*/
- public static Rectangle2D calculateBounds(IMoleculeSet moleculeSet) {
+ public static Rectangle2D calculateBounds(IAtomContainerSet moleculeSet) {
Rectangle2D totalBounds = new Rectangle2D.Double();
for (int i = 0; i < moleculeSet.getAtomContainerCount(); i++) {
IAtomContainer container = moleculeSet.getAtomContainer(i);
View
16 src/main/org/openscience/cdk/silent/ChemModel.java
@@ -19,10 +19,16 @@
package org.openscience.cdk.silent;
-import org.openscience.cdk.interfaces.*;
-
import java.io.Serializable;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
+import org.openscience.cdk.interfaces.IChemModel;
+import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
+import org.openscience.cdk.interfaces.IChemObjectListener;
+import org.openscience.cdk.interfaces.ICrystal;
+import org.openscience.cdk.interfaces.IReactionSet;
+import org.openscience.cdk.interfaces.IRingSet;
+
/**
* An object containing multiple MoleculeSet and
* the other lower level concepts like rings, sequences,
@@ -47,7 +53,7 @@
/**
* A MoleculeSet.
*/
- protected IMoleculeSet setOfMolecules = null;
+ protected IAtomContainerSet setOfMolecules = null;
/**
* A ReactionSet.
@@ -76,7 +82,7 @@ public ChemModel() {}
*
* @see #setMoleculeSet
*/
- public IMoleculeSet getMoleculeSet()
+ public IAtomContainerSet getMoleculeSet()
{
return this.setOfMolecules;
}
@@ -89,7 +95,7 @@ public IMoleculeSet getMoleculeSet()
*
* @see #getMoleculeSet
*/
- public void setMoleculeSet(IMoleculeSet setOfMolecules)
+ public void setMoleculeSet(IAtomContainerSet setOfMolecules)
{
this.setOfMolecules = setOfMolecules;
}
View
11 src/main/org/openscience/cdk/templates/MoleculeFactory.java
@@ -33,11 +33,12 @@
import org.openscience.cdk.Molecule;
import org.openscience.cdk.config.IsotopeFactory;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemSequence;
import org.openscience.cdk.interfaces.IMolecule;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.io.MDLReader;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
@@ -1299,14 +1300,14 @@ public static Molecule makeTetrahydropyran() {
}
- public static IMolecule loadMolecule(String inFile)
+ public static IAtomContainer loadMolecule(String inFile)
{
MDLReader mr = null;
ChemFile chemFile = null;
IChemSequence chemSequence = null;
IChemModel chemModel = null;
- IMoleculeSet setOfMolecules = null;
- IMolecule molecule = null;
+ IAtomContainerSet setOfMolecules = null;
+ IAtomContainer molecule = null;
try
{
FileInputStream fis = new FileInputStream(inFile);
@@ -1316,7 +1317,7 @@ public static IMolecule loadMolecule(String inFile)
chemSequence = chemFile.getChemSequence(0);
chemModel = chemSequence.getChemModel(0);
setOfMolecules = chemModel.getMoleculeSet();
- molecule = setOfMolecules.getMolecule(0);
+ molecule = setOfMolecules.getAtomContainer(0);
for (int i = 0; i < molecule.getAtomCount(); i++)
{
molecule.getAtom(i).setPoint2d(null);
View
28 src/main/org/openscience/cdk/tools/IDCreator.java
@@ -25,14 +25,30 @@
*/
package org.openscience.cdk.tools;
-import org.openscience.cdk.annotations.TestClass;
-import org.openscience.cdk.annotations.TestMethod;
-import org.openscience.cdk.interfaces.*;
-import org.openscience.cdk.tools.manipulator.*;
-
import java.util.Iterator;
import java.util.List;
+import org.openscience.cdk.annotations.TestClass;
+import org.openscience.cdk.annotations.TestMethod;
+import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
+import org.openscience.cdk.interfaces.IBond;
+import org.openscience.cdk.interfaces.IChemFile;
+import org.openscience.cdk.interfaces.IChemModel;
+import org.openscience.cdk.interfaces.IChemObject;
+import org.openscience.cdk.interfaces.IChemSequence;
+import org.openscience.cdk.interfaces.ICrystal;
+import org.openscience.cdk.interfaces.IReaction;
+import org.openscience.cdk.interfaces.IReactionSet;
+import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
+import org.openscience.cdk.tools.manipulator.AtomContainerSetManipulator;
+import org.openscience.cdk.tools.manipulator.ChemFileManipulator;
+import org.openscience.cdk.tools.manipulator.ChemModelManipulator;
+import org.openscience.cdk.tools.manipulator.ChemSequenceManipulator;
+import org.openscience.cdk.tools.manipulator.ReactionManipulator;
+import org.openscience.cdk.tools.manipulator.ReactionSetManipulator;
+
/**
* Class that provides methods to give unique IDs to ChemObjects.
* Methods are implemented for Atom, Bond, AtomContainer, AtomContainerSet
@@ -331,7 +347,7 @@ private static void createIDsForChemModel(IChemModel model, List<String> tabuLis
createIDsForAtomContainer(crystal, tabuList);
}
- IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
if (moleculeSet != null) {
if (policy == OBJECT_UNIQUE_POLICY) {
ATOMCONTAINERSET_COUNT = 0;
View
21 src/main/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java
@@ -34,6 +34,7 @@
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemObject;
@@ -75,7 +76,7 @@ public static int getAtomCount(IChemModel chemModel) {
if (crystal != null) {
count += crystal.getAtomCount();
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
count += MoleculeSetManipulator.getAtomCount(moleculeSet);
}
@@ -99,7 +100,7 @@ public static int getBondCount(IChemModel chemModel) {
if (crystal != null) {
count += crystal.getBondCount();
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
count += MoleculeSetManipulator.getBondCount(moleculeSet);
}
@@ -127,7 +128,7 @@ public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel
}
return;
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
MoleculeSetManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom);
}
@@ -153,7 +154,7 @@ public static void removeElectronContainer(IChemModel chemModel, IElectronContai
}
return;
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
MoleculeSetManipulator.removeElectronContainer(moleculeSet, electrons);
}
@@ -175,14 +176,14 @@ public static IAtomContainer createNewMolecule(IChemModel chemModel) {
// Add a new molecule either the set of molecules
IMolecule molecule = chemModel.getBuilder().newInstance(IMolecule.class);
if (chemModel.getMoleculeSet() != null) {
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
for(int i=0;i<moleculeSet.getAtomContainerCount();i++){
if(moleculeSet.getAtomContainer(i).getAtomCount()==0){
moleculeSet.removeAtomContainer(i);
i--;
}
}
- moleculeSet.addMolecule(molecule);
+ moleculeSet.addAtomContainer(molecule);
} else {
IMoleculeSet moleculeSet = chemModel.getBuilder().newInstance(IMoleculeSet.class);
moleculeSet.addMolecule(molecule);
@@ -222,7 +223,7 @@ public static IChemModel newChemModel(IAtomContainer atomContainer) {
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) {
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom);
if (result != null) {
return result;
@@ -248,7 +249,7 @@ public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAto
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond) {
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, bond);
if (result != null) {
return result;
@@ -339,7 +340,7 @@ public static void setAtomProperties(IChemModel chemModel, Object propKey, Objec
if (crystal != null) {
list.add(crystal);
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
list.add(moleculeSet);
List<IChemObject> current = MoleculeSetManipulator.getAllChemObjects(moleculeSet);
@@ -366,7 +367,7 @@ public static void setAtomProperties(IChemModel chemModel, Object propKey, Objec
if (crystal != null) {
list.addAll(AtomContainerManipulator.getAllIDs(crystal));
}
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
list.addAll(MoleculeSetManipulator.getAllIDs(moleculeSet));
}
View
22 src/main/org/openscience/cdk/tools/manipulator/MoleculeSetManipulator.java
@@ -54,12 +54,12 @@ public static int getBondCount(IAtomContainerSet set) {
}
@TestMethod("testRemoveAtomAndConnectedElectronContainers_IMoleculeSet_IAtom")
- public static void removeAtomAndConnectedElectronContainers(IMoleculeSet set, IAtom atom) {
+ public static void removeAtomAndConnectedElectronContainers(IAtomContainerSet set, IAtom atom) {
AtomContainerSetManipulator.removeAtomAndConnectedElectronContainers(set, atom);
}
@TestMethod("testRemoveElectronContainer_IMoleculeSet_IElectronContainer")
- public static void removeElectronContainer(IMoleculeSet set, IElectronContainer electrons) {
+ public static void removeElectronContainer(IAtomContainerSet set, IElectronContainer electrons) {
AtomContainerSetManipulator.removeElectronContainer(set, electrons);
}
@@ -69,7 +69,7 @@ public static void removeElectronContainer(IMoleculeSet set, IElectronContainer
* @return a list containing individual IAtomContainer's
*/
@TestMethod("testGetAllAtomContainers_IMoleculeSet")
- public static List<IAtomContainer> getAllAtomContainers(IMoleculeSet set) {
+ public static List<IAtomContainer> getAllAtomContainers(IAtomContainerSet set) {
return AtomContainerSetManipulator.getAllAtomContainers(set);
}
@@ -79,7 +79,7 @@ public static void removeElectronContainer(IMoleculeSet set, IElectronContainer
* @return The total charge on the collection of molecules
*/
@TestMethod("testGetTotalCharge_IMoleculeSet")
- public static double getTotalCharge(IMoleculeSet set) {
+ public static double getTotalCharge(IAtomContainerSet set) {
return AtomContainerSetManipulator.getTotalCharge(set);
}
@@ -89,7 +89,7 @@ public static double getTotalCharge(IMoleculeSet set) {
* @return The total formal charge on the collection of molecules
*/
@TestMethod("testGetTotalFormalCharge_IMoleculeSet")
- public static double getTotalFormalCharge(IMoleculeSet set) {
+ public static double getTotalFormalCharge(IAtomContainerSet set) {
return AtomContainerSetManipulator.getTotalFormalCharge(set);
}
@@ -99,35 +99,35 @@ public static double getTotalFormalCharge(IMoleculeSet set) {
* @return the total implicit hydrogen count on the collection of molecules
*/
@TestMethod("testGetTotalHydrogenCount_IMoleculeSet")
- public static int getTotalHydrogenCount(IMoleculeSet set) {
+ public static int getTotalHydrogenCount(IAtomContainerSet set) {
return AtomContainerSetManipulator.getTotalHydrogenCount(set);
}
@TestMethod("testGetAllIDs_IMoleculeSet")
- public static List<String> getAllIDs(IMoleculeSet set) {
+ public static List<String> getAllIDs(IAtomContainerSet set) {
List<String> list = new ArrayList<String>();
// the ID is set in AtomContainerSetManipulator.getAllIDs()
list.addAll(AtomContainerSetManipulator.getAllIDs(set));
return list;
}
@TestMethod("testSetAtomProperties_IMoleculeSet_Object_Object")
- public static void setAtomProperties(IMoleculeSet set, Object propKey, Object propVal) {
+ public static void setAtomProperties(IAtomContainerSet set, Object propKey, Object propVal) {
AtomContainerSetManipulator.setAtomProperties(set, propKey, propVal);
}
@TestMethod("testGetRelevantAtomContainer_IMoleculeSet_IAtom")
- public static IAtomContainer getRelevantAtomContainer(IMoleculeSet moleculeSet, IAtom atom) {
+ public static IAtomContainer getRelevantAtomContainer(IAtomContainerSet moleculeSet, IAtom atom) {
return AtomContainerSetManipulator.getRelevantAtomContainer(moleculeSet, atom);
}
@TestMethod("testGetRelevantAtomContainer_IMoleculeSet_IBond")
- public static IAtomContainer getRelevantAtomContainer(IMoleculeSet moleculeSet, IBond bond) {
+ public static IAtomContainer getRelevantAtomContainer(IAtomContainerSet moleculeSet, IBond bond) {
return AtomContainerSetManipulator.getRelevantAtomContainer(moleculeSet, bond);
}
@TestMethod("testGetAllChemObjects_IMoleculeSet")
- public static List<IChemObject> getAllChemObjects(IMoleculeSet set) {
+ public static List<IChemObject> getAllChemObjects(IAtomContainerSet set) {
return AtomContainerSetManipulator.getAllChemObjects(set);
}
View
7 src/main/org/openscience/cdk/validate/AbstractValidator.java
@@ -26,6 +26,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
@@ -36,9 +37,7 @@
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.interfaces.IIsotope;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IReaction;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReactionSet;
/**
@@ -102,15 +101,15 @@ public ValidationReport validateIsotope(IIsotope subject) {
ValidationReport report = new ValidationReport();
return report;
}
- public ValidationReport validateMolecule(IMolecule subject) {
+ public ValidationReport validateMolecule(IAtomContainer subject) {
ValidationReport report = new ValidationReport();
return report;
}
public ValidationReport validateReaction(IReaction subject) {
ValidationReport report = new ValidationReport();
return report;
}
- public ValidationReport validateMoleculeSet(IMoleculeSet subject) {
+ public ValidationReport validateMoleculeSet(IAtomContainerSet subject) {
ValidationReport report = new ValidationReport();
return report;
}
View
7 src/main/org/openscience/cdk/validate/IValidator.java
@@ -26,6 +26,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
@@ -36,9 +37,7 @@
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.interfaces.IIsotope;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IReaction;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReactionSet;
/**
@@ -62,9 +61,9 @@
public ValidationReport validateElectronContainer(IElectronContainer subject);
public ValidationReport validateElement(IElement subject);
public ValidationReport validateIsotope(IIsotope subject);
- public ValidationReport validateMolecule(IMolecule subject);
+ public ValidationReport validateMolecule(IAtomContainer subject);
public ValidationReport validateReaction(IReaction subject);
- public ValidationReport validateMoleculeSet(IMoleculeSet subject);
+ public ValidationReport validateMoleculeSet(IAtomContainerSet subject);
public ValidationReport validateReactionSet(IReactionSet subject);
}
View
10 src/main/org/openscience/cdk/validate/ValidatorEngine.java
@@ -26,6 +26,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
@@ -36,7 +37,6 @@
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.interfaces.IIsotope;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.interfaces.IReactionSet;
@@ -181,7 +181,7 @@ public ValidationReport validateChemModel(IChemModel subject) {
if (reactionSet != null) {
report.addReport(validateReactionSet(reactionSet));
}
- IMoleculeSet moleculeSet = subject.getMoleculeSet();
+ IAtomContainerSet moleculeSet = subject.getMoleculeSet();
if (moleculeSet != null) {
report.addReport(validateMoleculeSet(moleculeSet));
}
@@ -262,7 +262,7 @@ public ValidationReport validateIsotope(IIsotope subject) {
// traverse into hierarchy
return report;
}
- public ValidationReport validateMolecule(IMolecule subject) {
+ public ValidationReport validateMolecule(IAtomContainer subject) {
logger.info("Validating org.openscience.cdk.Molecule");
ValidationReport report = new ValidationReport();
// apply validators
@@ -294,7 +294,7 @@ public ValidationReport validateReaction(IReaction subject) {
}
return report;
}
- public ValidationReport validateMoleculeSet(IMoleculeSet subject) {
+ public ValidationReport validateMoleculeSet(IAtomContainerSet subject) {
logger.info("Validating org.openscience.cdk.MoleculeSet");
ValidationReport report = new ValidationReport();
// apply validators
@@ -305,7 +305,7 @@ public ValidationReport validateMoleculeSet(IMoleculeSet subject) {
report.addReport(validateChemObject(subject));
// traverse into hierarchy
for (int i=0; i<subject.getAtomContainerCount(); i++) {
- report.addReport(validateMolecule(subject.getMolecule(i)));
+ report.addReport(validateMolecule(subject.getAtomContainer(i)));
}
return report;
}
View
37 src/test/org/openscience/cdk/geometry/BondToolsTest.java
@@ -30,6 +30,7 @@
import org.openscience.cdk.ChemObject;
import org.openscience.cdk.config.AtomTypeFactory;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.io.MDLV2000Reader;
@@ -52,7 +53,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.isValidDoubleBondConfiguration(mol, mol.getBond(0)));
Assert.assertFalse(BondTools.isValidDoubleBondConfiguration(mol, mol.getBond(1)));
Assert.assertFalse(BondTools.isValidDoubleBondConfiguration(mol, mol.getBond(2)));
@@ -68,7 +69,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertFalse(BondTools.isCisTrans(mol.getAtom(2),mol.getAtom(0),mol.getAtom(1),mol.getAtom(4),mol));
}
@@ -77,7 +78,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertFalse(BondTools.isLeft(mol.getAtom(1),mol.getAtom(0),mol.getAtom(2)));
}
@@ -86,7 +87,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngleBothMethods(mol.getAtom(0),mol.getAtom(2),mol.getAtom(3),true),0.2);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngleBothMethods(mol.getAtom(0),mol.getAtom(2),mol.getAtom(3),false),0.2);
}
@@ -104,7 +105,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
NoNotificationChemObjectBuilder.getInstance()
);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Iterator atoms = mol.atoms().iterator();
while (atoms.hasNext()) {
atf.configure((IAtom)atoms.next());
@@ -118,7 +119,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngleBothMethods(mol.getAtom(0).getPoint2d(),mol.getAtom(2).getPoint2d(),mol.getAtom(3).getPoint2d(),true),0.2);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngleBothMethods(mol.getAtom(0).getPoint2d(),mol.getAtom(2).getPoint2d(),mol.getAtom(3).getPoint2d(),false),0.2);
}
@@ -128,14 +129,14 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(BondTools.isTetrahedral(mol,mol.getAtom(0),true),1);
Assert.assertEquals(BondTools.isTetrahedral(mol,mol.getAtom(1),true),0);
filename = "data/mdl/tetrahedral_1_lazy.mol";
ins = this.getClass().getClassLoader().getResourceAsStream(filename);
reader = new MDLV2000Reader(ins);
chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(BondTools.isTetrahedral(mol,mol.getAtom(0),true),0);
Assert.assertEquals(BondTools.isTetrahedral(mol,mol.getAtom(0),false),3);
}
@@ -145,7 +146,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol,mol.getAtom(0)),1);
Assert.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol,mol.getAtom(1)),0);
}
@@ -155,7 +156,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.isStereo(mol,mol.getAtom(0)));
Assert.assertFalse(BondTools.isStereo(mol,mol.getAtom(1)));
}
@@ -165,7 +166,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
for(int i=1;i<6;i++){
mol.getAtom(i).setSymbol("C");
}
@@ -178,7 +179,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.isSquarePlanar(mol,mol.getAtom(0)));
Assert.assertFalse(BondTools.isSquarePlanar(mol,mol.getAtom(1)));
}
@@ -188,13 +189,13 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertFalse(BondTools.stereosAreOpposite(mol,mol.getAtom(0)));
filename = "data/mdl/tetrahedral_with_four_wedges.mol";
ins = this.getClass().getClassLoader().getResourceAsStream(filename);
reader = new MDLV2000Reader(ins);
chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.stereosAreOpposite(mol,mol.getAtom(0)));
}
@@ -203,7 +204,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
BondTools.makeUpDownBonds(mol);
Assert.assertEquals(IBond.Stereo.DOWN,mol.getBond(3).getStereo());
}
@@ -213,7 +214,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngle(mol.getAtom(0),mol.getAtom(2),mol.getAtom(3)),0.2);
}
@@ -222,7 +223,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(2.0943946986086157,BondTools.giveAngleFromMiddle(mol.getAtom(0),mol.getAtom(2),mol.getAtom(3)),0.2);
}
@@ -234,7 +235,7 @@ public void testIsValidDoubleBondConfiguration_IAtomContainer_IBond() throws Exc
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
- IMolecule mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ IAtomContainer mol=chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.isStereo(mol, mol.getAtom(5)));
}
}
View
6 src/test/org/openscience/cdk/graph/SpanningTreeTest.java
@@ -35,12 +35,12 @@
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
+import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemSequence;
import org.openscience.cdk.interfaces.IMolecule;
-import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IRingSet;
-import org.openscience.cdk.io.MDLV2000Reader;
import org.openscience.cdk.io.IChemObjectReader.Mode;
+import org.openscience.cdk.io.MDLV2000Reader;
import org.openscience.cdk.templates.MoleculeFactory;
/**
@@ -61,7 +61,7 @@ public void setUp() throws Exception {
IChemFile chemFile = (IChemFile) reader.read(new ChemFile());
IChemSequence seq = chemFile.getChemSequence(0);
IChemModel model = seq.getChemModel(0);
- IMolecule azuleneMolecule = model.getMoleculeSet().getMolecule(0);
+ IAtomContainer azuleneMolecule = model.getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(10, azuleneMolecule.getAtomCount());
Assert.assertEquals(11, azuleneMolecule.getBondCount());
azulene = new SpanningTree(azuleneMolecule);
View
32 src/test/org/openscience/cdk/graph/invariant/ConjugatedPiSystemsDetectorTest.java
@@ -77,7 +77,7 @@ public static void setup() {
public void testDetectButadiene() throws Exception
{
logger.info("Entering testDetectButadiene.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/cml/butadiene.cml";
mol = readCMLMolecule(filename);
@@ -106,7 +106,7 @@ public void testDetectButadiene() throws Exception
@Test public void testDetectNaphtalene() throws Exception
{
logger.info("Entering testDetectNaphtalene.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/cml/naphtalene.cml";
mol = readCMLMolecule(filename);
@@ -135,7 +135,7 @@ public void testDetectButadiene() throws Exception
@Test public void testDetectToluene() throws Exception
{
logger.info("Entering testDetectToluene.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/cml/toluene.cml";
mol = readCMLMolecule(filename);
@@ -164,12 +164,12 @@ public void testDetectButadiene() throws Exception
@Test public void testNonConnectedPiSystems() throws Exception
{
logger.info("Entering testNonConnectedPiSystems.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/mdl/nonConnectedPiSystems.mol";
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLReader reader = new MDLReader(ins);
IChemFile chemFile = (IChemFile)reader.read((ChemObject)new ChemFile());
- mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
IAtomContainerSet acSet = ConjugatedPiSystemsDetector.detect(mol);
@@ -207,12 +207,12 @@ public void testDetectButadiene() throws Exception
@Test public void testPiSystemWithCarbokation() throws Exception
{
logger.info("Entering testPiSystemWithCarbokation.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/mdl/piSystemWithCarbokation.mol";
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLReader reader = new MDLReader(ins);
IChemFile chemFile = (IChemFile)reader.read((ChemObject)new ChemFile());
- mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
@@ -248,12 +248,12 @@ public void testDetectButadiene() throws Exception
@Test public void testPiSystemWithCumulativeDB() throws Exception
{
logger.info("Entering testPiSystemWithCumulativeDB.");
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/mdl/piSystemCumulative.mol";
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLReader reader = new MDLReader(ins);
IChemFile chemFile = (IChemFile)reader.read((ChemObject)new ChemFile());
- mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
@@ -325,12 +325,12 @@ public void testDetectButadiene() throws Exception
*/
@Test public void testNN_dimethylaniline_cation() throws Exception
{
- IMolecule mol = null;
+ IAtomContainer mol = null;
String filename = "data/mdl/NN_dimethylaniline.mol";
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
IChemFile chemFile = (IChemFile)reader.read((ChemObject)new ChemFile());
- mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
+ mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
addImplicitHydrogens(mol);
lpcheck.saturate(mol);
@@ -442,8 +442,8 @@ public void testDetectButadiene() throws Exception
*
*@return Description of the Return Value
*/
- private IMolecule readCMLMolecule(String filename) throws Exception {
- IMolecule mol = null;
+ private IAtomContainer readCMLMolecule(String filename) throws Exception {
+ IAtomContainer mol = null;
logger.debug("Filename: " + filename);
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
CMLReader reader = new CMLReader(ins);
@@ -456,10 +456,10 @@ private IMolecule readCMLMolecule(String filename) throws Exception {
Assert.assertEquals(1, sequence.getChemModelCount());
IChemModel chemModel = sequence.getChemModel(0);
Assert.assertNotNull(chemModel);
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
Assert.assertNotNull(moleculeSet);
- Assert.assertEquals(1, moleculeSet.getMoleculeCount());
- mol = moleculeSet.getMolecule(0);
+ Assert.assertEquals(1, moleculeSet.getAtomContainerCount());
+ mol = moleculeSet.getAtomContainer(0);
Assert.assertNotNull(mol);
return mol;
View
4 src/test/org/openscience/cdk/interfaces/AbstractChemModelTest.java
@@ -34,14 +34,14 @@
*/
public abstract class AbstractChemModelTest extends AbstractChemObjectTest {
- @Test public void testSetMoleculeSet_IMoleculeSet() {
+ @Test public void testSetMoleculeSet_IAtomContainerSet() {
IChemModel chemModel = (IChemModel)newChemObject();
IMoleculeSet crystal = chemModel.getBuilder().newInstance(IMoleculeSet.class);
chemModel.setMoleculeSet(crystal);
Assert.assertEquals(crystal, chemModel.getMoleculeSet());
}
@Test public void testGetMoleculeSet() {
- testSetMoleculeSet_IMoleculeSet();
+ testSetMoleculeSet_IAtomContainerSet();
}
@Test public void testSetReactionSet_IReactionSet() {
View
4 src/test/org/openscience/cdk/io/CTXReaderTest.java
@@ -36,10 +36,10 @@
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemObject;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemSequence;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
@@ -79,7 +79,7 @@
IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
Assert.assertNotNull(moleculeSet);
Assert.assertEquals(1, moleculeSet.getAtomContainerCount());
View
14 src/test/org/openscience/cdk/io/GhemicalReaderTest.java
@@ -36,6 +36,8 @@
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemModel;
import org.openscience.cdk.ChemObject;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
/**
* TestCase for the reading Ghemical molecular dynamics files using one test file.
@@ -92,10 +94,10 @@
Assert.assertNotNull(model);
Assert.assertNotNull(model.getMoleculeSet());
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(6, m.getAtomCount());
Assert.assertEquals(5, m.getBondCount());
@@ -122,10 +124,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(6, m.getAtomCount());
Assert.assertEquals(5, m.getBondCount());
View
23 src/test/org/openscience/cdk/io/HINReaderTest.java
@@ -27,6 +27,9 @@
* */
package org.openscience.cdk.io;
+import java.io.InputStream;
+import java.util.List;
+
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -35,14 +38,12 @@
import org.openscience.cdk.ChemObject;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
import org.openscience.cdk.tools.manipulator.ChemFileManipulator;
-import java.io.InputStream;
-import java.util.List;
-
/**
* TestCase for the reading HIN mol files using one test file.
*
@@ -78,10 +79,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(12, m.getAtomCount());
// assertEquals(?, m.getBondCount());
@@ -102,10 +103,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(37, m.getAtomCount());
// assertEquals(?, m.getBondCount());
@@ -126,9 +127,9 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(3, som.getMoleculeCount());
+ Assert.assertEquals(3, som.getAtomContainerCount());
}
@Test public void testIsConnectedFromHINFile() throws Exception {
View
16 src/test/org/openscience/cdk/io/INChIPlainTextReaderTest.java
@@ -27,17 +27,19 @@
* */
package org.openscience.cdk.io;
+import java.io.InputStream;
+import java.io.StringReader;
+
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemObject;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
-import java.io.InputStream;
-import java.io.StringReader;
-
/**
* TestCase for the reading INChI plain text files.
*
@@ -78,9 +80,9 @@
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
Assert.assertNotNull(moleculeSet);
- org.openscience.cdk.interfaces.IMolecule molecule = moleculeSet.getMolecule(0);
+ IAtomContainer molecule = moleculeSet.getAtomContainer(0);
Assert.assertNotNull(molecule);
Assert.assertEquals(11, molecule.getAtomCount());
@@ -100,9 +102,9 @@
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
Assert.assertNotNull(moleculeSet);
- org.openscience.cdk.interfaces.IMolecule molecule = moleculeSet.getMolecule(0);
+ IAtomContainer molecule = moleculeSet.getAtomContainer(0);
Assert.assertNotNull(molecule);
Assert.assertEquals(40, molecule.getAtomCount());
View
6 src/test/org/openscience/cdk/io/INChIReaderTest.java
@@ -35,6 +35,8 @@
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemObject;
import org.openscience.cdk.exception.CDKException;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
@@ -77,9 +79,9 @@
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
Assert.assertNotNull(moleculeSet);
- org.openscience.cdk.interfaces.IMolecule molecule = moleculeSet.getMolecule(0);
+ IAtomContainer molecule = moleculeSet.getAtomContainer(0);
Assert.assertNotNull(molecule);
Assert.assertEquals(11, molecule.getAtomCount());
View
8 src/test/org/openscience/cdk/io/MDLReaderTest.java
@@ -35,11 +35,11 @@
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemModel;
import org.openscience.cdk.ChemObject;
-import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
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.io.IChemObjectReader.Mode;
@@ -108,10 +108,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(9, m.getAtomCount());
Assert.assertEquals(9, m.getBondCount());
View
20 src/test/org/openscience/cdk/io/MDLV2000ReaderTest.java
@@ -26,7 +26,6 @@
import java.io.InputStream;
import java.io.StringReader;
-
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -36,7 +35,6 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemModel;
@@ -47,6 +45,7 @@
import org.openscience.cdk.geometry.GeometryTools;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IMolecule;
@@ -137,10 +136,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(4, m.getAtomCount());
Assert.assertEquals(2, m.getBondCount());
@@ -387,10 +386,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(9, m.getAtomCount());
Assert.assertEquals(9, m.getBondCount());
@@ -457,8 +456,9 @@
InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
IChemFile chemFile = reader.read(new ChemFile());
- Assert.assertEquals(1, chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0).getAtom(6).getFormalCharge().intValue());
- Assert.assertEquals(-1, chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0).getAtom(8).getFormalCharge().intValue());
+ IAtomContainer container = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
+ Assert.assertEquals(1, container.getAtom(6).getFormalCharge().intValue());
+ Assert.assertEquals(-1, container.getAtom(8).getFormalCharge().intValue());
}
@Test public void testEmptyString() throws Exception {
View
23 src/test/org/openscience/cdk/io/Mol2ReaderTest.java
@@ -27,6 +27,14 @@
* */
package org.openscience.cdk.io;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
+
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
@@ -37,6 +45,7 @@
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IMolecule;
@@ -46,14 +55,6 @@
import org.openscience.cdk.tools.manipulator.ChemFileManipulator;
import org.openscience.cdk.tools.manipulator.ChemModelManipulator;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-
/**
* TestCase for the reading SYBYL mol2 files using a test file.
*
@@ -96,10 +97,10 @@
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
- org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet();
+ IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
- Assert.assertEquals(1, som.getMoleculeCount());
- org.openscience.cdk.interfaces.IMolecule m = som.getMolecule(0);
+ Assert.assertEquals(1, som.getAtomContainerCount());
+ IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(12, m.getAtomCount());
Assert.assertEquals(12, m.getBondCount());
View
22 src/test/org/openscience/cdk/io/PDBReaderTest.java
@@ -93,7 +93,7 @@
.getChemSequence(0)
.getChemModel(0)
.getMoleculeSet()
- .getMolecule(0)
+ .getAtomContainer(0)
.getBondCount();
/*
* if ReadConnectSection=true and UseRebondTool=false
@@ -149,9 +149,9 @@ public void oldFormatNewFormatTest() throws Exception {
IChemModel oModel = oSeq.getChemModel(0);
Assert.assertNotNull(oModel);
- Assert.assertEquals(1, oModel.getMoleculeSet().getMoleculeCount());
+ Assert.assertEquals(1, oModel.getMoleculeSet().getAtomContainerCount());
- IAtomContainer container = oModel.getMoleculeSet().getMolecule(0);
+ IAtomContainer container = oModel.getMoleculeSet().