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
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:
- Keywords:
- reaction
- Created on:
- 2003-02-13
-
Nested Class Summary
Nested classes/interfaces inherited from interface IReaction
IReaction.DirectionModifier and TypeInterfaceDescriptionstatic enumPermissible reaction directions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IAtomContainerSetThese are the used solvent, catalysts etc that normally appear above the reaction arrowprotected final intprotected IMapping[]protected intprotected IAtomContainerSetprotected IAtomContainerSetFields inherited from interface IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HIDDEN, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, MARKUSH, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITEDModifier and TypeFieldDescriptionstatic final intFlag that is set if a ChemObject is part of an aliphatic chain.static final intFlag is set if ChemObject is part of an aromatic system.static final intFlag is set if ChemObject is part of a conjugated system.static final intThis flag can be used when depicted structures to hide certain parts, for example the things are abbreviated (display shortcuts).static final intSets to true if the atom is a hydrogen bond acceptor.static final intSets to true if the atom is a hydrogen bond donor.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag is set if a ChemObject is mapped to another ChemObject.static final intFlag to indicate a flattened molecule holds a Markush structure, you can work on it as is or it might make more sense to repack into something sensible like a RGroupQuery.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag that is set if the ChemObject is placed when calculating 2D/3D layouts.static final intFlag is set if a ChemObject has reactive center.static final intFlag used for marking uncertainty of the bond order.static final intFlag is set if an atom could be typed.static final intFlag is set if ChemObject has been visited. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAgent(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.clone()Clones thisReactionand its content.intReturns the number of agents in this reaction.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.intGet 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.intReturns 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.intReturns 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.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.toString()Returns a one line string representation of this Atom.Methods inherited from class 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, shallowCopyModifier and TypeMethodDescriptionvoidUse this to add yourself to this IChemObject as a listener.voidaddProperties(Map<Object, Object> properties) Sets the properties of this object.voidclear(int flags) Clear the provided flags.booleanCompares a IChemObject with this IChemObject.intflags()Access the current value of the flags for this ChemObject.Returns aIChemObjectBuilderfor the data classes that extend this class.booleangetFlag(int mask) Returns the value of a given flag.boolean[]getFlags()Returns the whole set of flags.Access the internal value used to store the flags.getID()Returns the identifier (ID) of this object.intReturns the number of ChemObjectListeners registered with this object.booleanReturns the flag that indicates whether notification messages are sent around.Returns a Map with the IChemObject's properties.<T> TgetProperty(Object description) Returns a property for the IChemObject.<T> TgetProperty(Object description, Class<T> c) Access a property of the given description and cast the specified class.booleanis(int flags) Test if a flag(s) are set on this ChemObject.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidUse this to remove a ChemObjectListener from the ListenerList of this IChemObject.voidremoveProperty(Object description) Removes a property for a IChemObject.voidset(int flags) Set the provided flags.voidsetFlag(int mask, boolean value) Sets the value of some flag.voidsetFlags(boolean[] flagsNew) Sets the whole set of flags.voidSets the identifier (ID) of this object.voidsetNotification(boolean bool) Set a flag to use or not use notification.voidsetProperties(Map<Object, Object> properties) Set the properties of this object to the provided map (shallow copy).voidsetProperty(Object description, Object property) Sets a property for a IChemObject.Clones thisIChemObject, but preserves references toObjects.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IReaction
iteratorModifier and TypeMethodDescriptiondefault Iterator<IAtomContainer> iterator()An iterator for all the containers in this reaction.Methods inherited from interface Iterable
forEach, spliterator
-
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:
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
Returns a MoleculeSet containing the reactants in this reaction.- Specified by:
getReactantsin interfaceIReaction- Returns:
- A MoleculeSet containing the reactants in this reaction
- See Also:
-
setReactants
Assigns a MoleculeSet to the reactants in this reaction.- Specified by:
setReactantsin interfaceIReaction- Parameters:
setOfMolecules- The new set of reactants- See Also:
-
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:
-
setProducts
Assigns a MoleculeSet to the products of this reaction.- Specified by:
setProductsin interfaceIReaction- Parameters:
setOfMolecules- The new set of products- See Also:
-
getAgents
Returns a MoleculeSet containing the agents in this reaction. -
mappings
-
addReactant
Adds a reactant to this reaction.- Specified by:
addReactantin 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:
addReactantin 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:
addProductin interfaceIReaction- Parameters:
product- Molecule added as product to this reaction- See Also:
-
addProduct
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:
-
getReactantCoefficient
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:
-
getProductCoefficient
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:
-
setReactantCoefficient
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:
-
setProductCoefficient
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:
-
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:
-
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:
-
setReactantCoefficients
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:
-
setProductCoefficients
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:
-
setDirection
Sets the direction of the reaction.- Specified by:
setDirectionin interfaceIReaction- Parameters:
direction- The new reaction direction- See Also:
-
getDirection
Returns the direction of the reaction.- Specified by:
getDirectionin 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:
addMappingin 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:
removeMappingin 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:
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
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
Clones thisReactionand its content.- Specified by:
clonein interfaceIChemObject- Overrides:
clonein classChemObject- Returns:
- The cloned object
- Throws:
CloneNotSupportedException- if the IChemObject cannot be cloned
-