Package org.openscience.cdk
Class Reaction
java.lang.Object
org.openscience.cdk.ChemObject
org.openscience.cdk.Reaction
- All Implemented Interfaces:
Serializable
,Cloneable
,ICDKObject
,IChemObject
,IReaction
- Direct Known Subclasses:
DebugReaction
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:
- Source code:
- main
- Belongs to CDK module:
- data
- 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
FieldsModifier and TypeFieldDescriptionprotected IAtomContainerSet
These are the used solvent, catalysts etc that normally appear above the reaction arrowprotected final int
protected IMapping[]
protected int
protected IAtomContainerSet
protected IAtomContainerSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAgent
(IAtomContainer agent) Adds an agent to this reaction.void
addMapping
(IMapping mapping) Adds a mapping between the reactant and product side to this Reaction.void
addProduct
(IAtomContainer product) Adds a product to this reaction.void
addProduct
(IAtomContainer product, Double coefficient) Adds a product to this reaction.void
addReactant
(IAtomContainer reactant) Adds a reactant to this reaction.void
addReactant
(IAtomContainer reactant, Double coefficient) Adds a reactant to this reaction with a stoichiometry coefficient.clone()
Clones thisReaction
and its content.Returns a MoleculeSet containing the agents in this reaction.Returns the direction of the reaction.getMapping
(int pos) Retrieves a mapping between the reactant and product side to this Reaction.int
Get the number of mappings between the reactant and product side to this Reaction.getProductCoefficient
(IAtomContainer product) Returns the stoichiometry coefficient of the given product.Double[]
Returns an array of double with the stoichiometric coefficients of the products.int
Returns the number of products in this reaction.Returns a MoleculeSet containing the products of this reaction.getReactantCoefficient
(IAtomContainer reactant) Returns the stoichiometry coefficient of the given reactant.Double[]
Returns an array of double with the stoichiometric coefficients of the reactants.int
Returns the number of reactants in this reaction.Returns a MoleculeSet containing the reactants in this reaction.mappings()
Returns the mappings between the reactant and the product side.void
removeMapping
(int pos) Removes a mapping between the reactant and product side to this Reaction.void
setDirection
(IReaction.Direction direction) Sets the direction of the reaction.boolean
setProductCoefficient
(IAtomContainer product, Double coefficient) Sets the coefficient of a a product to a given value.boolean
setProductCoefficients
(Double[] coefficients) Sets the coefficient of the products.void
setProducts
(IAtomContainerSet setOfMolecules) Assigns a MoleculeSet to the products of this reaction.boolean
setReactantCoefficient
(IAtomContainer reactant, Double coefficient) Sets the coefficient of a a reactant to a given value.boolean
setReactantCoefficients
(Double[] coefficients) Sets the coefficients of the reactants.void
setReactants
(IAtomContainerSet setOfMolecules) Assigns a MoleculeSet to the reactants in this reaction.toString()
Returns a one line string representation of this Atom.Methods inherited from class org.openscience.cdk.ChemObject
addListener, addProperties, compare, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, 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, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty
-
Field Details
-
growArraySize
protected final int growArraySize- See Also:
-
reactants
-
products
-
agents
These are the used solvent, catalysts etc that normally appear above the reaction arrow -
map
-
mappingCount
protected int mappingCount
-
-
Constructor Details
-
Reaction
public Reaction()Constructs an empty, forward reaction.
-
-
Method Details
-
getReactantCount
public int getReactantCount()Returns the number of reactants in this reaction.- Specified by:
getReactantCount
in interfaceIReaction
- Returns:
- The number of reactants in this reaction
-
getProductCount
public int getProductCount()Returns the number of products in this reaction.- Specified by:
getProductCount
in interfaceIReaction
- Returns:
- The number of products in this reaction
-
getReactants
Returns a MoleculeSet containing the reactants in this reaction.- Specified by:
getReactants
in interfaceIReaction
- Returns:
- A MoleculeSet containing the reactants in this reaction
- See Also:
-
setReactants
Assigns a MoleculeSet to the reactants in this reaction.- Specified by:
setReactants
in interfaceIReaction
- Parameters:
setOfMolecules
- The new set of reactants- See Also:
-
getProducts
Returns a MoleculeSet containing the products of this reaction.- Specified by:
getProducts
in interfaceIReaction
- Returns:
- A MoleculeSet containing the products in this reaction
- See Also:
-
setProducts
Assigns a MoleculeSet to the products of this reaction.- Specified by:
setProducts
in interfaceIReaction
- Parameters:
setOfMolecules
- The new set of products- See Also:
-
getAgents
Returns a MoleculeSet containing the agents in this reaction. -
mappings
Returns the mappings between the reactant and the product side. -
addReactant
Adds a reactant to this reaction.- Specified by:
addReactant
in interfaceIReaction
- Parameters:
reactant
- Molecule added as reactant to this reaction- See Also:
-
addAgent
Adds an agent to this reaction. -
addReactant
Adds a reactant to this reaction with a stoichiometry coefficient.- Specified by:
addReactant
in interfaceIReaction
- Parameters:
reactant
- Molecule added as reactant to this reactioncoefficient
- Stoichiometry coefficient for this molecule- See Also:
-
addProduct
Adds a product to this reaction.- Specified by:
addProduct
in interfaceIReaction
- Parameters:
product
- Molecule added as product to this reaction- See Also:
-
addProduct
Adds a product to this reaction.- Specified by:
addProduct
in interfaceIReaction
- Parameters:
product
- Molecule added as product to this reactioncoefficient
- Stoichiometry coefficient for this molecule- See Also:
-
getReactantCoefficient
Returns the stoichiometry coefficient of the given reactant.- Specified by:
getReactantCoefficient
in 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:
-
getProductCoefficient
Returns the stoichiometry coefficient of the given product.- Specified by:
getProductCoefficient
in 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:
-
setReactantCoefficient
Sets the coefficient of a a reactant to a given value.- Specified by:
setReactantCoefficient
in 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:
-
setProductCoefficient
Sets the coefficient of a a product to a given value.- Specified by:
setProductCoefficient
in 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:
-
getReactantCoefficients
Returns an array of double with the stoichiometric coefficients of the reactants.- Specified by:
getReactantCoefficients
in interfaceIReaction
- Returns:
- An array of double's containing the coefficients of the reactants
- See Also:
-
getProductCoefficients
Returns an array of double with the stoichiometric coefficients of the products.- Specified by:
getProductCoefficients
in interfaceIReaction
- Returns:
- An array of double's containing the coefficients of the products
- See Also:
-
setReactantCoefficients
Sets the coefficients of the reactants.- Specified by:
setReactantCoefficients
in interfaceIReaction
- Parameters:
coefficients
- An array of double's containing the coefficients of the reactants- Returns:
- true if coefficients have been set.
- See Also:
-
setProductCoefficients
Sets the coefficient of the products.- Specified by:
setProductCoefficients
in interfaceIReaction
- Parameters:
coefficients
- An array of double's containing the coefficients of the products- Returns:
- true if coefficients have been set.
- See Also:
-
setDirection
Sets the direction of the reaction.- Specified by:
setDirection
in interfaceIReaction
- Parameters:
direction
- The new reaction direction- See Also:
-
getDirection
Returns the direction of the reaction.- Specified by:
getDirection
in interfaceIReaction
- Returns:
- The direction of this reaction (FORWARD, BACKWARD or BIDIRECTIONAL).
- See Also:
-
addMapping
Adds a mapping between the reactant and product side to this Reaction.- Specified by:
addMapping
in interfaceIReaction
- Parameters:
mapping
- Mapping to add.- See Also:
-
removeMapping
public void removeMapping(int pos) Removes a mapping between the reactant and product side to this Reaction.- Specified by:
removeMapping
in interfaceIReaction
- Parameters:
pos
- Position of the Mapping to remove.- See Also:
-
getMapping
Retrieves a mapping between the reactant and product side to this Reaction.- Specified by:
getMapping
in 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:
getMappingCount
in interfaceIReaction
- Returns:
- Number of stored Mappings.
-
toString
Returns a one line string representation of this Atom. Methods is conform RFC #9.- Specified by:
toString
in interfaceIChemObject
- Overrides:
toString
in classObject
- Returns:
- The string representation of this Atom
-
clone
Clones thisReaction
and its content.- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classChemObject
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-