Package org.openscience.cdk.silent
Class Reaction
- java.lang.Object
-
- org.openscience.cdk.silent.ChemObject
-
- org.openscience.cdk.silent.Reaction
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<IAtomContainer>,ICDKObject,IChemObject,IReaction
public class Reaction extends ChemObject implements Serializable, IReaction, Cloneable
Represents the idea of a chemical reaction. The reaction consists of a set of reactants and a set of products.The class mostly represents abstract reactions, such as 2D diagrams, and is not intended to represent reaction trajectories. Such can better be represented with a ChemSequence.
- Author:
- Egon Willighagen <elw38@cam.ac.uk>
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- silent
- Keywords:
- reaction
- Created on:
- 2003-02-13
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openscience.cdk.interfaces.IReaction
IReaction.Direction
-
-
Field Summary
Fields Modifier and Type Field Description protected IAtomContainerSetagentsThese are the used solvent, catalysts etc that normally appear above the reaction arrowprotected intgrowArraySizeprotected IMapping[]mapprotected intmappingCountprotected IAtomContainerSetproductsprotected IAtomContainerSetreactants-
Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED
-
-
Constructor Summary
Constructors Constructor Description Reaction()Constructs an empty, forward reaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAgent(IAtomContainer agent)Adds an agent to this reaction.voidaddMapping(IMapping mapping)Adds a mapping between the reactant and product side to this Reaction.voidaddProduct(IAtomContainer product)Adds a product to this reaction.voidaddProduct(IAtomContainer product, Double coefficient)Adds a product to this reaction.voidaddReactant(IAtomContainer reactant)Adds a reactant to this reaction.voidaddReactant(IAtomContainer reactant, Double coefficient)Adds a reactant to this reaction with a stoichiometry coefficient.Objectclone()Clones thisReactionand its content.intgetAgentCount()Returns the number of agents in this reaction.IAtomContainerSetgetAgents()Returns a MoleculeSet containing the agents in this reaction.IReaction.DirectiongetDirection()Returns the direction of the reaction.IMappinggetMapping(int pos)Retrieves a mapping between the reactant and product side to this Reaction.intgetMappingCount()Get the number of mappings between the reactant and product side to this Reaction.DoublegetProductCoefficient(IAtomContainer product)Returns the stoichiometry coefficient of the given product.Double[]getProductCoefficients()Returns an array of double with the stoichiometric coefficients of the products.intgetProductCount()Returns the number of products in this reaction.IAtomContainerSetgetProducts()Returns a MoleculeSet containing the products of this reaction.DoublegetReactantCoefficient(IAtomContainer reactant)Returns the stoichiometry coefficient of the given reactant.Double[]getReactantCoefficients()Returns an array of double with the stoichiometric coefficients of the reactants.intgetReactantCount()Returns the number of reactants in this reaction.IAtomContainerSetgetReactants()Returns a MoleculeSet containing the reactants in this reaction.Iterable<IMapping>mappings()Returns the mappings between the reactant and the product side.voidremoveMapping(int pos)Removes a mapping between the reactant and product side to this Reaction.voidsetDirection(IReaction.Direction direction)Sets the direction of the reaction.booleansetProductCoefficient(IAtomContainer product, Double coefficient)Sets the coefficient of a a product to a given value.booleansetProductCoefficients(Double[] coefficients)Sets the coefficient of the products.voidsetProducts(IAtomContainerSet setOfMolecules)Assigns a MoleculeSet to the products of this reaction.booleansetReactantCoefficient(IAtomContainer reactant, Double coefficient)Sets the coefficient of a a reactant to a given value.booleansetReactantCoefficients(Double[] coefficients)Sets the coefficients of the reactants.voidsetReactants(IAtomContainerSet setOfMolecules)Assigns a MoleculeSet to the reactants in this reaction.StringtoString()Returns a one line string representation of this Atom.-
Methods inherited from class org.openscience.cdk.silent.ChemObject
addListener, addProperties, clear, compare, flags, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopy
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilder
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, clear, flags, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
growArraySize
protected final int growArraySize
- See Also:
- Constant Field Values
-
reactants
protected IAtomContainerSet reactants
-
products
protected IAtomContainerSet products
-
agents
protected IAtomContainerSet agents
These are the used solvent, catalysts etc that normally appear above the reaction arrow
-
map
protected IMapping[] map
-
mappingCount
protected int mappingCount
-
-
Method Detail
-
getReactantCount
public int getReactantCount()
Returns the number of reactants in this reaction.- Specified by:
getReactantCountin interfaceIReaction- Returns:
- The number of reactants in this reaction
-
getProductCount
public int getProductCount()
Returns the number of products in this reaction.- Specified by:
getProductCountin interfaceIReaction- Returns:
- The number of products in this reaction
-
getAgentCount
public int getAgentCount()
Returns the number of agents in this reaction.- Specified by:
getAgentCountin interfaceIReaction- Returns:
- The number of agents in this reaction
-
getReactants
public IAtomContainerSet getReactants()
Returns a MoleculeSet containing the reactants in this reaction.- Specified by:
getReactantsin interfaceIReaction- Returns:
- A MoleculeSet containing the reactants in this reaction
- See Also:
IReaction.setReactants(org.openscience.cdk.interfaces.IAtomContainerSet)
-
setReactants
public void setReactants(IAtomContainerSet setOfMolecules)
Assigns a MoleculeSet to the reactants in this reaction.- Specified by:
setReactantsin interfaceIReaction- Parameters:
setOfMolecules- The new set of reactants- See Also:
getReactants()
-
getProducts
public IAtomContainerSet getProducts()
Returns a MoleculeSet containing the products of this reaction.- Specified by:
getProductsin interfaceIReaction- Returns:
- A MoleculeSet containing the products in this reaction
- See Also:
IReaction.setProducts(org.openscience.cdk.interfaces.IAtomContainerSet)
-
setProducts
public void setProducts(IAtomContainerSet setOfMolecules)
Assigns a MoleculeSet to the products of this reaction.- Specified by:
setProductsin interfaceIReaction- Parameters:
setOfMolecules- The new set of products- See Also:
getProducts()
-
getAgents
public IAtomContainerSet getAgents()
Returns a MoleculeSet containing the agents in this reaction.- Specified by:
getAgentsin interfaceIReaction- Returns:
- A MoleculeSet containing the agents in this reaction
- See Also:
addAgent(org.openscience.cdk.interfaces.IAtomContainer)
-
mappings
public Iterable<IMapping> mappings()
Returns the mappings between the reactant and the product side.- Specified by:
mappingsin interfaceIReaction- Returns:
- An Iterator to the Mappings.
- See Also:
addMapping(org.openscience.cdk.interfaces.IMapping)
-
addReactant
public void addReactant(IAtomContainer reactant)
Adds a reactant to this reaction.- Specified by:
addReactantin interfaceIReaction- Parameters:
reactant- Molecule added as reactant to this reaction- See Also:
getReactants()
-
addAgent
public void addAgent(IAtomContainer agent)
Adds an agent to this reaction.- Specified by:
addAgentin interfaceIReaction- Parameters:
agent- Molecule added as agent to this reaction- See Also:
getAgents()
-
addReactant
public void addReactant(IAtomContainer reactant, Double coefficient)
Adds a reactant to this reaction with a stoichiometry coefficient.- Specified by:
addReactantin interfaceIReaction- Parameters:
reactant- Molecule added as reactant to this reactioncoefficient- Stoichiometry coefficient for this molecule- See Also:
getReactants()
-
addProduct
public void addProduct(IAtomContainer product)
Adds a product to this reaction.- Specified by:
addProductin interfaceIReaction- Parameters:
product- Molecule added as product to this reaction- See Also:
getProducts()
-
addProduct
public void addProduct(IAtomContainer product, Double coefficient)
Adds a product to this reaction.- Specified by:
addProductin interfaceIReaction- Parameters:
product- Molecule added as product to this reactioncoefficient- Stoichiometry coefficient for this molecule- See Also:
getProducts()
-
getReactantCoefficient
public Double getReactantCoefficient(IAtomContainer reactant)
Returns the stoichiometry coefficient of the given reactant.- Specified by:
getReactantCoefficientin interfaceIReaction- Parameters:
reactant- Reactant for which the coefficient is returned.- Returns:
- -1, if the given molecule is not a product in this Reaction
- See Also:
setReactantCoefficient(org.openscience.cdk.interfaces.IAtomContainer, java.lang.Double)
-
getProductCoefficient
public Double getProductCoefficient(IAtomContainer product)
Returns the stoichiometry coefficient of the given product.- Specified by:
getProductCoefficientin interfaceIReaction- Parameters:
product- Product for which the coefficient is returned.- Returns:
- -1, if the given molecule is not a product in this Reaction
- See Also:
setProductCoefficient(org.openscience.cdk.interfaces.IAtomContainer, java.lang.Double)
-
setReactantCoefficient
public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient)
Sets the coefficient of a a reactant to a given value.- Specified by:
setReactantCoefficientin interfaceIReaction- Parameters:
reactant- Reactant for which the coefficient is setcoefficient- The new coefficient for the given reactant- Returns:
- true if Molecule has been found and stoichiometry has been set.
- See Also:
getReactantCoefficient(org.openscience.cdk.interfaces.IAtomContainer)
-
setProductCoefficient
public boolean setProductCoefficient(IAtomContainer product, Double coefficient)
Sets the coefficient of a a product to a given value.- Specified by:
setProductCoefficientin interfaceIReaction- Parameters:
product- Product for which the coefficient is setcoefficient- The new coefficient for the given product- Returns:
- true if Molecule has been found and stoichiometry has been set.
- See Also:
getProductCoefficient(org.openscience.cdk.interfaces.IAtomContainer)
-
getReactantCoefficients
public Double[] getReactantCoefficients()
Returns an array of double with the stoichiometric coefficients of the reactants.- Specified by:
getReactantCoefficientsin interfaceIReaction- Returns:
- An array of double's containing the coefficients of the reactants
- See Also:
setReactantCoefficients(java.lang.Double[])
-
getProductCoefficients
public Double[] getProductCoefficients()
Returns an array of double with the stoichiometric coefficients of the products.- Specified by:
getProductCoefficientsin interfaceIReaction- Returns:
- An array of double's containing the coefficients of the products
- See Also:
setProductCoefficients(java.lang.Double[])
-
setReactantCoefficients
public boolean setReactantCoefficients(Double[] coefficients)
Sets the coefficients of the reactants.- Specified by:
setReactantCoefficientsin interfaceIReaction- Parameters:
coefficients- An array of double's containing the coefficients of the reactants- Returns:
- true if coefficients have been set.
- See Also:
getReactantCoefficients()
-
setProductCoefficients
public boolean setProductCoefficients(Double[] coefficients)
Sets the coefficient of the products.- Specified by:
setProductCoefficientsin interfaceIReaction- Parameters:
coefficients- An array of double's containing the coefficients of the products- Returns:
- true if coefficients have been set.
- See Also:
getProductCoefficients()
-
setDirection
public void setDirection(IReaction.Direction direction)
Sets the direction of the reaction.- Specified by:
setDirectionin interfaceIReaction- Parameters:
direction- The new reaction direction- See Also:
getDirection()
-
getDirection
public IReaction.Direction getDirection()
Returns the direction of the reaction.- Specified by:
getDirectionin interfaceIReaction- Returns:
- The direction of this reaction (FORWARD, BACKWARD or BIDIRECTIONAL).
- See Also:
IReaction.Direction,setDirection(org.openscience.cdk.interfaces.IReaction.Direction)
-
addMapping
public void addMapping(IMapping mapping)
Adds a mapping between the reactant and product side to this Reaction.- Specified by:
addMappingin interfaceIReaction- Parameters:
mapping- Mapping to add.- See Also:
mappings()
-
removeMapping
public void removeMapping(int pos)
Removes a mapping between the reactant and product side to this Reaction.- Specified by:
removeMappingin interfaceIReaction- Parameters:
pos- Position of the Mapping to remove.- See Also:
mappings()
-
getMapping
public IMapping getMapping(int pos)
Retrieves a mapping between the reactant and product side to this Reaction.- Specified by:
getMappingin interfaceIReaction- Parameters:
pos- Position of Mapping to get.- Returns:
- the mapping identified by the specified position
-
getMappingCount
public int getMappingCount()
Get the number of mappings between the reactant and product side to this Reaction.- Specified by:
getMappingCountin interfaceIReaction- Returns:
- Number of stored Mappings.
-
toString
public String toString()
Returns a one line string representation of this Atom. Methods is conform RFC #9.- Specified by:
toStringin interfaceIChemObject- Overrides:
toStringin classObject- Returns:
- The string representation of this Atom
-
clone
public Object clone() throws CloneNotSupportedException
Clones thisReactionand its content.- Specified by:
clonein interfaceIChemObject- Overrides:
clonein classChemObject- Returns:
- The cloned object
- Throws:
CloneNotSupportedException- if the IChemObject cannot be cloned
-
-