Skip to content

Commit

Permalink
Replaced IMolecule with IAtomContainer for some IReaction methods
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Dec 3, 2011
1 parent 2c1b31a commit 3d3037f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
21 changes: 11 additions & 10 deletions src/main/org/openscience/cdk/Reaction.java
Expand Up @@ -196,7 +196,7 @@ public void remove() {
* @param reactant Molecule added as reactant to this reaction
* @see #getReactants
*/
public void addReactant(IMolecule reactant) {
public void addReactant(IAtomContainer reactant) {
addReactant(reactant, 1.0);
/* notifyChanged() is called by
addReactant(Molecule reactant, double coefficient) */
Expand All @@ -208,7 +208,7 @@ public void addReactant(IMolecule reactant) {
* @param agent Molecule added as agent to this reaction
* @see #getAgents
*/
public void addAgent(IMolecule agent) {
public void addAgent(IAtomContainer agent) {
agents.addAtomContainer(agent);
notifyChanged();
}
Expand All @@ -220,7 +220,7 @@ public void addAgent(IMolecule agent) {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getReactants
*/
public void addReactant(IMolecule reactant, Double coefficient) {
public void addReactant(IAtomContainer reactant, Double coefficient) {
reactants.addAtomContainer(reactant, coefficient);
notifyChanged();
}
Expand All @@ -231,7 +231,7 @@ public void addReactant(IMolecule reactant, Double coefficient) {
* @param product Molecule added as product to this reaction
* @see #getProducts
*/
public void addProduct(IMolecule product) {
public void addProduct(IAtomContainer product) {
this.addProduct(product, 1.0);
/* notifyChanged() is called by
addProduct(Molecule product, double coefficient)*/
Expand All @@ -244,7 +244,7 @@ public void addProduct(IMolecule product) {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getProducts
*/
public void addProduct(IMolecule product, Double coefficient) {
public void addProduct(IAtomContainer product, Double coefficient) {
products.addAtomContainer(product, coefficient);
/* notifyChanged() is called by
addReactant(Molecule reactant, double coefficient) */
Expand All @@ -257,7 +257,7 @@ public void addProduct(IMolecule product, Double coefficient) {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setReactantCoefficient
*/
public Double getReactantCoefficient(IMolecule reactant) {
public Double getReactantCoefficient(IAtomContainer reactant) {
return reactants.getMultiplier(reactant);
}

Expand All @@ -268,7 +268,7 @@ public Double getReactantCoefficient(IMolecule reactant) {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setProductCoefficient
*/
public Double getProductCoefficient(IMolecule product) {
public Double getProductCoefficient(IAtomContainer product) {
return products.getMultiplier(product);
}

Expand All @@ -280,7 +280,7 @@ public Double getProductCoefficient(IMolecule product) {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getReactantCoefficient
*/
public boolean setReactantCoefficient(IMolecule reactant, Double coefficient) {
public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient) {
boolean result = reactants.setMultiplier(reactant, coefficient);
notifyChanged();
return result;
Expand All @@ -295,7 +295,7 @@ public boolean setReactantCoefficient(IMolecule reactant, Double coefficient) {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getProductCoefficient
*/
public boolean setProductCoefficient(IMolecule product, Double coefficient) {
public boolean setProductCoefficient(IAtomContainer product, Double coefficient) {
boolean result = products.setMultiplier(product, coefficient);
notifyChanged();
return result;
Expand Down Expand Up @@ -473,4 +473,5 @@ public Object clone() throws CloneNotSupportedException {
}
return clone;
}
}

}
18 changes: 9 additions & 9 deletions src/main/org/openscience/cdk/interfaces/IReaction.java
Expand Up @@ -126,15 +126,15 @@ public enum Direction {
* @param reactant Molecule added as reactant to this reaction
* @see #getReactants
*/
public void addReactant(IMolecule reactant);
public void addReactant(IAtomContainer reactant);

/**
* Adds an agent to this reaction.
*
* @param agent Molecule added as agent to this reaction
* @see #getAgents
*/
public void addAgent(IMolecule agent);
public void addAgent(IAtomContainer agent);

/**
* Adds a reactant to this reaction with a stoichiometry coefficient.
Expand All @@ -143,15 +143,15 @@ public enum Direction {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getReactants
*/
public void addReactant(IMolecule reactant, Double coefficient);
public void addReactant(IAtomContainer reactant, Double coefficient);

/**
* Adds a product to this reaction.
*
* @param product Molecule added as product to this reaction
* @see #getProducts
*/
public void addProduct(IMolecule product);
public void addProduct(IAtomContainer product);

/**
* Adds a product to this reaction.
Expand All @@ -160,7 +160,7 @@ public enum Direction {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getProducts
*/
public void addProduct(IMolecule product, Double coefficient);
public void addProduct(IAtomContainer product, Double coefficient);

/**
* Returns the stoichiometry coefficient of the given reactant.
Expand All @@ -169,7 +169,7 @@ public enum Direction {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setReactantCoefficient
*/
public Double getReactantCoefficient(IMolecule reactant);
public Double getReactantCoefficient(IAtomContainer reactant);

/**
* Returns the stoichiometry coefficient of the given product.
Expand All @@ -178,7 +178,7 @@ public enum Direction {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setProductCoefficient
*/
public Double getProductCoefficient(IMolecule product);
public Double getProductCoefficient(IAtomContainer product);

/**
* Sets the coefficient of a a reactant to a given value.
Expand All @@ -188,7 +188,7 @@ public enum Direction {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getReactantCoefficient
*/
public boolean setReactantCoefficient(IMolecule reactant, Double coefficient);
public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient);

/**
* Sets the coefficient of a a product to a given value.
Expand All @@ -198,7 +198,7 @@ public enum Direction {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getProductCoefficient
*/
public boolean setProductCoefficient(IMolecule product, Double coefficient);
public boolean setProductCoefficient(IAtomContainer product, Double coefficient);

/**
* Returns an array of double with the stoichiometric coefficients
Expand Down
19 changes: 10 additions & 9 deletions src/main/org/openscience/cdk/silent/Reaction.java
Expand Up @@ -192,7 +192,7 @@ public void remove() {
* @param reactant Molecule added as reactant to this reaction
* @see #getReactants
*/
public void addReactant(IMolecule reactant) {
public void addReactant(IAtomContainer reactant) {
addReactant(reactant, 1.0);
/* notifyChanged() is called by
addReactant(Molecule reactant, double coefficient) */
Expand All @@ -204,7 +204,7 @@ public void addReactant(IMolecule reactant) {
* @param agent Molecule added as agent to this reaction
* @see #getAgents
*/
public void addAgent(IMolecule agent) {
public void addAgent(IAtomContainer agent) {
agents.addAtomContainer(agent);
}

Expand All @@ -215,7 +215,7 @@ public void addAgent(IMolecule agent) {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getReactants
*/
public void addReactant(IMolecule reactant, Double coefficient) {
public void addReactant(IAtomContainer reactant, Double coefficient) {
reactants.addAtomContainer(reactant, coefficient);
}

Expand All @@ -225,7 +225,7 @@ public void addReactant(IMolecule reactant, Double coefficient) {
* @param product Molecule added as product to this reaction
* @see #getProducts
*/
public void addProduct(IMolecule product) {
public void addProduct(IAtomContainer product) {
this.addProduct(product, 1.0);
/* notifyChanged() is called by
addProduct(Molecule product, double coefficient)*/
Expand All @@ -238,7 +238,7 @@ public void addProduct(IMolecule product) {
* @param coefficient Stoichiometry coefficient for this molecule
* @see #getProducts
*/
public void addProduct(IMolecule product, Double coefficient) {
public void addProduct(IAtomContainer product, Double coefficient) {
products.addAtomContainer(product, coefficient);
/* notifyChanged() is called by
addReactant(Molecule reactant, double coefficient) */
Expand All @@ -251,7 +251,7 @@ public void addProduct(IMolecule product, Double coefficient) {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setReactantCoefficient
*/
public Double getReactantCoefficient(IMolecule reactant) {
public Double getReactantCoefficient(IAtomContainer reactant) {
return reactants.getMultiplier(reactant);
}

Expand All @@ -262,7 +262,7 @@ public Double getReactantCoefficient(IMolecule reactant) {
* @return -1, if the given molecule is not a product in this Reaction
* @see #setProductCoefficient
*/
public Double getProductCoefficient(IMolecule product) {
public Double getProductCoefficient(IAtomContainer product) {
return products.getMultiplier(product);
}

Expand All @@ -274,7 +274,7 @@ public Double getProductCoefficient(IMolecule product) {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getReactantCoefficient
*/
public boolean setReactantCoefficient(IMolecule reactant, Double coefficient) {
public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient) {
boolean result = reactants.setMultiplier(reactant, coefficient);
return result;
}
Expand All @@ -288,7 +288,7 @@ public boolean setReactantCoefficient(IMolecule reactant, Double coefficient) {
* @return true if Molecule has been found and stoichiometry has been set.
* @see #getProductCoefficient
*/
public boolean setProductCoefficient(IMolecule product, Double coefficient) {
public boolean setProductCoefficient(IAtomContainer product, Double coefficient) {
boolean result = products.setMultiplier(product, coefficient);
return result;
}
Expand Down Expand Up @@ -460,4 +460,5 @@ public Object clone() throws CloneNotSupportedException {
}
return clone;
}

}

0 comments on commit 3d3037f

Please sign in to comment.