Skip to content

Commit

Permalink
Modified IReaction and related classes to migrate from IMoleculeSet t…
Browse files Browse the repository at this point in the history
…o IAtomContainerSet

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
rajarshi authored and egonw committed Dec 8, 2011
1 parent 7f6617d commit 19b7673
Show file tree
Hide file tree
Showing 92 changed files with 2,936 additions and 2,824 deletions.
21 changes: 13 additions & 8 deletions src/main/org/openscience/cdk/Reaction.java
Expand Up @@ -25,7 +25,12 @@
*/
package org.openscience.cdk;

import org.openscience.cdk.interfaces.*;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IMapping;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;

import java.io.Serializable;
import java.util.Hashtable;
Expand Down Expand Up @@ -61,8 +66,8 @@ public class Reaction extends ChemObject implements Serializable, IReaction, Clo

protected int growArraySize = 3;

protected IMoleculeSet reactants;
protected IMoleculeSet products;
protected IAtomContainerSet reactants;
protected IAtomContainerSet products;
/** These are the used solvent, catalysts etc that normally appear above
the reaction arrow */
protected IMoleculeSet agents;
Expand All @@ -76,8 +81,8 @@ public class Reaction extends ChemObject implements Serializable, IReaction, Clo
* Constructs an empty, forward reaction.
*/
public Reaction() {
this.reactants = new MoleculeSet();
this.products = new MoleculeSet();
this.reactants = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class);
this.products = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class);
this.agents = new MoleculeSet();
this.map = new Mapping[growArraySize];
mappingCount = 0;
Expand Down Expand Up @@ -108,7 +113,7 @@ public int getProductCount() {
* @return A MoleculeSet containing the reactants in this reaction
* @see #setReactants
*/
public IMoleculeSet getReactants() {
public IAtomContainerSet getReactants() {
return reactants;
}

Expand All @@ -129,7 +134,7 @@ public void setReactants(IMoleculeSet setOfMolecules) {
* @return A MoleculeSet containing the products in this reaction
* @see #setProducts
*/
public IMoleculeSet getProducts() {
public IAtomContainerSet getProducts() {
return products;
}

Expand Down Expand Up @@ -462,7 +467,7 @@ public Object clone() throws CloneNotSupportedException {
Map<IAtom, IAtom> atomatom = new Hashtable<IAtom, IAtom>();
for (int i = 0; i < reactants.getAtomContainerCount(); ++i) {
Molecule mol = (Molecule)((MoleculeSet)reactants).getMolecule(i);
Molecule mol2 = (Molecule)clone.reactants.getMolecule(i);
Molecule mol2 = (Molecule)clone.reactants.getAtomContainer(i);
for (int j = 0; j < mol.getAtomCount(); ++j) atomatom.put(mol.getAtom(j), mol2.getAtom(j));
}

Expand Down

0 comments on commit 19b7673

Please sign in to comment.