Skip to content

Commit

Permalink
Refactored the setters from IReaction to use IAtomContainer*
Browse files Browse the repository at this point in the history
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
rajarshi authored and egonw committed Dec 8, 2011
1 parent 91f8083 commit 04cbb29
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/main/org/openscience/cdk/Reaction.java
Expand Up @@ -111,7 +111,7 @@ public int getProductCount() {
* Returns a MoleculeSet containing the reactants in this reaction.
*
* @return A MoleculeSet containing the reactants in this reaction
* @see #setReactants
* @see org.openscience.cdk.interfaces.IReaction#setReactants
*/
public IAtomContainerSet getReactants() {
return reactants;
Expand All @@ -120,10 +120,11 @@ public IAtomContainerSet getReactants() {
/**
* Assigns a MoleculeSet to the reactants in this reaction.
*
*
* @param setOfMolecules The new set of reactants
* @see #getReactants
*/
public void setReactants(IMoleculeSet setOfMolecules) {
public void setReactants(IAtomContainerSet setOfMolecules) {
reactants = setOfMolecules;
notifyChanged();
}
Expand All @@ -132,7 +133,7 @@ public void setReactants(IMoleculeSet setOfMolecules) {
* Returns a MoleculeSet containing the products of this reaction.
*
* @return A MoleculeSet containing the products in this reaction
* @see #setProducts
* @see org.openscience.cdk.interfaces.IReaction#setProducts
*/
public IAtomContainerSet getProducts() {
return products;
Expand All @@ -141,10 +142,11 @@ public IAtomContainerSet getProducts() {
/**
* Assigns a MoleculeSet to the products of this reaction.
*
*
* @param setOfMolecules The new set of products
* @see #getProducts
*/
public void setProducts(IMoleculeSet setOfMolecules) {
public void setProducts(IAtomContainerSet setOfMolecules) {
products = setOfMolecules;
notifyChanged();
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/org/openscience/cdk/debug/DebugReaction.java
Expand Up @@ -26,7 +26,6 @@
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
Expand Down Expand Up @@ -162,7 +161,7 @@ public IAtomContainerSet getReactants() {
return super.getReactants();
}

public void setReactants(IMoleculeSet reactants) {
public void setReactants(IAtomContainerSet reactants) {
logger.debug("Setting reactants: ", reactants);
super.setReactants(reactants);
}
Expand All @@ -172,7 +171,7 @@ public IAtomContainerSet getProducts() {
return super.getProducts();
}

public void setProducts(IMoleculeSet products) {
public void setProducts(IAtomContainerSet products) {
logger.debug("Setting products: ", products);
super.setProducts(products);
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/org/openscience/cdk/interfaces/IReaction.java
Expand Up @@ -83,10 +83,11 @@ public enum Direction {
/**
* Assigns a IMoleculeSet to the reactants in this reaction.
*
*
* @param reactants The new set of reactants
* @see #getReactants
*/
public void setReactants(IMoleculeSet reactants);
public void setReactants(IAtomContainerSet reactants);

/**
* Returns a IMoleculeSet containing the products of this reaction.
Expand All @@ -99,10 +100,11 @@ public enum Direction {
/**
* Assigns a IMoleculeSet to the products of this reaction.
*
*
* @param products The new set of products
* @see #getProducts
*/
public void setProducts(IMoleculeSet products);
public void setProducts(IAtomContainerSet products);

/**
* Returns a IMoleculeSet containing the agents in this reaction.
Expand Down
10 changes: 6 additions & 4 deletions src/main/org/openscience/cdk/silent/Reaction.java
Expand Up @@ -109,7 +109,7 @@ public int getProductCount() {
* Returns a MoleculeSet containing the reactants in this reaction.
*
* @return A MoleculeSet containing the reactants in this reaction
* @see #setReactants
* @see org.openscience.cdk.interfaces.IReaction#setReactants
*/
public IAtomContainerSet getReactants() {
return reactants;
Expand All @@ -118,18 +118,19 @@ public IAtomContainerSet getReactants() {
/**
* Assigns a MoleculeSet to the reactants in this reaction.
*
*
* @param setOfMolecules The new set of reactants
* @see #getReactants
*/
public void setReactants(IMoleculeSet setOfMolecules) {
public void setReactants(IAtomContainerSet setOfMolecules) {
reactants = setOfMolecules;
}

/**
* Returns a MoleculeSet containing the products of this reaction.
*
* @return A MoleculeSet containing the products in this reaction
* @see #setProducts
* @see org.openscience.cdk.interfaces.IReaction#setProducts
*/
public IAtomContainerSet getProducts() {
return products;
Expand All @@ -138,10 +139,11 @@ public IAtomContainerSet getProducts() {
/**
* Assigns a MoleculeSet to the products of this reaction.
*
*
* @param setOfMolecules The new set of products
* @see #getProducts
*/
public void setProducts(IMoleculeSet setOfMolecules) {
public void setProducts(IAtomContainerSet setOfMolecules) {
products = setOfMolecules;
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/org/openscience/cdk/smiles/SmilesParserTest.java
Expand Up @@ -20,9 +20,6 @@
*/
package org.openscience.cdk.smiles;

import java.util.Iterator;
import java.util.List;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Ignore;
Expand Down Expand Up @@ -57,6 +54,9 @@
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;
import org.openscience.cdk.tools.manipulator.BondManipulator;

import java.util.Iterator;
import java.util.List;

/**
* Please see the test.gui package for visual feedback on tests.
*
Expand Down Expand Up @@ -986,7 +986,7 @@ public void testReactionWithAgents() throws Exception {
Assert.assertEquals(2, reaction.getProductCount());
Assert.assertEquals(1, reaction.getAgents().getAtomContainerCount());

Assert.assertEquals(1, reaction.getAgents().getMolecule(0).getAtomCount());
Assert.assertEquals(1, reaction.getAgents().getAtomContainer(0).getAtomCount());
}


Expand Down

0 comments on commit 04cbb29

Please sign in to comment.