Package org.openscience.cdk.debug
Class DebugReaction
- java.lang.Object
-
- org.openscience.cdk.ChemObject
-
- org.openscience.cdk.Reaction
-
- org.openscience.cdk.debug.DebugReaction
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ICDKObject
,IChemObject
,IReaction
public class DebugReaction extends Reaction implements IReaction
Debugging data class.- Author:
- egonw
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- datadebug
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openscience.cdk.interfaces.IReaction
IReaction.Direction
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.Reaction
agents, growArraySize, map, mappingCount, products, reactants
-
-
Constructor Summary
Constructors Constructor Description DebugReaction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAgent(IAtomContainer agent)
Adds an agent to this reaction.void
addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener.void
addProduct(IAtomContainer product)
Adds a product to this reaction.void
addProduct(IAtomContainer product, Double coefficient)
Adds a product to this reaction.void
addProperties(Map<Object,Object> properties)
Sets the properties of this object.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.Object
clone()
Clones thisReaction
and its content.IAtomContainerSet
getAgents()
Returns a MoleculeSet containing the agents in this reaction.IChemObjectBuilder
getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.IReaction.Direction
getDirection()
Returns the direction of the reaction.boolean
getFlag(int flagType)
Returns the value of a given flag.boolean[]
getFlags()
Returns the whole set of flags.String
getID()
Returns the identifier (ID) of this object.int
getListenerCount()
Returns the number of ChemObjectListeners registered with this object.Double
getProductCoefficient(IAtomContainer product)
Returns the stoichiometry coefficient of the given product.Double[]
getProductCoefficients()
Returns an array of double with the stoichiometric coefficients of the products.int
getProductCount()
Returns the number of products in this reaction.IAtomContainerSet
getProducts()
Returns a MoleculeSet containing the products of this reaction.Map<Object,Object>
getProperties()
Returns a Map with the IChemObject's properties.<T> T
getProperty(Object description)
Returns a property for the IChemObject.Double
getReactantCoefficient(IAtomContainer reactant)
Returns the stoichiometry coefficient of the given reactant.Double[]
getReactantCoefficients()
Returns an array of double with the stoichiometric coefficients of the reactants.int
getReactantCount()
Returns the number of reactants in this reaction.IAtomContainerSet
getReactants()
Returns a MoleculeSet containing the reactants in this reaction.void
notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.void
notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.void
removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject.void
removeProperty(Object description)
Removes a property for a IChemObject.void
setDirection(IReaction.Direction direction)
Sets the direction of the reaction.void
setFlag(int flagType, boolean flagValue)
Sets the value of some flag.void
setFlags(boolean[] flagsNew)
Sets the whole set of flags.void
setID(String identifier)
Sets the identifier (ID) of this object.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 products)
Assigns a MoleculeSet to the products of this reaction.void
setProperty(Object description, Object property)
Sets a property for a IChemObject.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 reactants)
Assigns a MoleculeSet to the reactants in this reaction.-
Methods inherited from class org.openscience.cdk.Reaction
addMapping, getMapping, getMappingCount, mappings, removeMapping, toString
-
Methods inherited from class org.openscience.cdk.ChemObject
compare, getFlagValue, getNotification, getProperty, setNotification, setProperties, 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.IChemObject
getFlagValue, getNotification, getProperty, setNotification, setProperties, toString
-
Methods inherited from interface org.openscience.cdk.interfaces.IReaction
addMapping, getMapping, getMappingCount, mappings, removeMapping
-
-
-
-
Method Detail
-
addListener
public void addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener. In order to do so, you must implement the ChemObjectListener Interface.- Specified by:
addListener
in interfaceIChemObject
- Overrides:
addListener
in classChemObject
- Parameters:
col
- the ChemObjectListener- See Also:
ChemObject.removeListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
getListenerCount
public int getListenerCount()
Returns the number of ChemObjectListeners registered with this object.- Specified by:
getListenerCount
in interfaceIChemObject
- Overrides:
getListenerCount
in classChemObject
- Returns:
- the number of registered listeners.
-
removeListener
public void removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject. It will then not be notified of change in this object anymore.- Specified by:
removeListener
in interfaceIChemObject
- Overrides:
removeListener
in classChemObject
- Parameters:
col
- The ChemObjectListener to be removed- See Also:
ChemObject.addListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
notifyChanged
public void notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
-
notifyChanged
public void notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it. This is a version of notifyChanged() which allows to propagate a change event while preserving the original origin.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
- Parameters:
evt
- A ChemObjectChangeEvent pointing to the source of where the change happened
-
setProperty
public void setProperty(Object description, Object property)
Sets a property for a IChemObject.- Specified by:
setProperty
in interfaceIChemObject
- Overrides:
setProperty
in classChemObject
- Parameters:
description
- An object description of the property (most likely a unique string)property
- An object with the property itself- See Also:
ChemObject.getProperty(java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
removeProperty
public void removeProperty(Object description)
Removes a property for a IChemObject.- Specified by:
removeProperty
in interfaceIChemObject
- Overrides:
removeProperty
in classChemObject
- Parameters:
description
- The object description of the property (most likely a unique string)- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.getProperty(java.lang.Object)
-
getProperty
public <T> T getProperty(Object description)
Returns a property for the IChemObject.- Specified by:
getProperty
in interfaceIChemObject
- Overrides:
getProperty
in classChemObject
- Type Parameters:
T
- generic return type- Parameters:
description
- An object description of the property (most likely a unique string)- Returns:
- The object containing the property. Returns null if propert is not set.
- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
getProperties
public Map<Object,Object> getProperties()
Returns a Map with the IChemObject's properties.- Specified by:
getProperties
in interfaceIChemObject
- Overrides:
getProperties
in classChemObject
- Returns:
- The object's properties as an Hashtable
- See Also:
ChemObject.addProperties(java.util.Map<java.lang.Object, java.lang.Object>)
-
getID
public String getID()
Returns the identifier (ID) of this object.- Specified by:
getID
in interfaceIChemObject
- Overrides:
getID
in classChemObject
- Returns:
- a String representing the ID value
- See Also:
ChemObject.setID(java.lang.String)
-
setID
public void setID(String identifier)
Sets the identifier (ID) of this object.- Specified by:
setID
in interfaceIChemObject
- Overrides:
setID
in classChemObject
- Parameters:
identifier
- a String representing the ID value- See Also:
ChemObject.getID()
-
setFlag
public void setFlag(int flagType, boolean flagValue)
Sets the value of some flag. The flag is a mask from a given CDKConstant (e.g.CDKConstants.ISAROMATIC
orCDKConstants.VISITED
). The flags are intrinsic internal properties and should not be used to store custom values, please useIChemObject.setProperty(Object, Object)
.// set this chem object to be aromatic chemObject.setFlag(CDKConstants.ISAROMATIC, Boolean.TRUE); // ... // indicate we have visited this chem object chemObject.setFlag(CDKConstants.VISITED, Boolean.TRUE);
- Specified by:
setFlag
in interfaceIChemObject
- Overrides:
setFlag
in classChemObject
- Parameters:
flagType
- flag to set the value forflagValue
- value to assign to flag- See Also:
IChemObject.getFlag(int)
,CDKConstants
-
getFlag
public boolean getFlag(int flagType)
Returns the value of a given flag. The flag is a mask from a given CDKConstant (e.g.CDKConstants.ISAROMATIC
).if(chemObject.getFlag(CDKConstants.ISAROMATIC)){ // handle aromatic flag on this chem object }
- Specified by:
getFlag
in interfaceIChemObject
- Overrides:
getFlag
in classChemObject
- Parameters:
flagType
- flag to retrieve the value of- Returns:
- true if the flag
flag_type
is set - See Also:
IChemObject.setFlag(int, boolean)
,CDKConstants
-
addProperties
public void addProperties(Map<Object,Object> properties)
Sets the properties of this object.- Specified by:
addProperties
in interfaceIChemObject
- Overrides:
addProperties
in classChemObject
- Parameters:
properties
- a Hashtable specifying the property values- See Also:
ChemObject.getProperties()
-
setFlags
public void setFlags(boolean[] flagsNew)
Sets the whole set of flags.- Specified by:
setFlags
in interfaceIChemObject
- Overrides:
setFlags
in classChemObject
- Parameters:
flagsNew
- the new flags.- See Also:
ChemObject.getFlags()
-
getFlags
public boolean[] getFlags()
Returns the whole set of flags.- Specified by:
getFlags
in interfaceIChemObject
- Overrides:
getFlags
in classChemObject
- Returns:
- the flags.
- See Also:
ChemObject.setFlags(boolean[])
-
clone
public Object clone() throws CloneNotSupportedException
Clones thisReaction
and its content.- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classReaction
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
getBuilder
public IChemObjectBuilder getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.- Specified by:
getBuilder
in interfaceICDKObject
- Overrides:
getBuilder
in classChemObject
- Returns:
- The
IChemObjectBuilder
matching thisICDKObject
-
getReactantCount
public int getReactantCount()
Returns the number of reactants in this reaction.- Specified by:
getReactantCount
in interfaceIReaction
- Overrides:
getReactantCount
in classReaction
- 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
- Overrides:
getProductCount
in classReaction
- Returns:
- The number of products in this reaction
-
getReactants
public IAtomContainerSet getReactants()
Returns a MoleculeSet containing the reactants in this reaction.- Specified by:
getReactants
in interfaceIReaction
- Overrides:
getReactants
in classReaction
- Returns:
- A MoleculeSet containing the reactants in this reaction
- See Also:
IReaction.setReactants(org.openscience.cdk.interfaces.IAtomContainerSet)
-
setReactants
public void setReactants(IAtomContainerSet reactants)
Assigns a MoleculeSet to the reactants in this reaction.- Specified by:
setReactants
in interfaceIReaction
- Overrides:
setReactants
in classReaction
- Parameters:
reactants
- The new set of reactants- See Also:
Reaction.getReactants()
-
getProducts
public IAtomContainerSet getProducts()
Returns a MoleculeSet containing the products of this reaction.- Specified by:
getProducts
in interfaceIReaction
- Overrides:
getProducts
in classReaction
- Returns:
- A MoleculeSet containing the products in this reaction
- See Also:
IReaction.setProducts(org.openscience.cdk.interfaces.IAtomContainerSet)
-
setProducts
public void setProducts(IAtomContainerSet products)
Assigns a MoleculeSet to the products of this reaction.- Specified by:
setProducts
in interfaceIReaction
- Overrides:
setProducts
in classReaction
- Parameters:
products
- The new set of products- See Also:
Reaction.getProducts()
-
getAgents
public IAtomContainerSet getAgents()
Returns a MoleculeSet containing the agents in this reaction.- Specified by:
getAgents
in interfaceIReaction
- Overrides:
getAgents
in classReaction
- Returns:
- A MoleculeSet containing the agents in this reaction
- See Also:
Reaction.addAgent(org.openscience.cdk.interfaces.IAtomContainer)
-
addReactant
public void addReactant(IAtomContainer reactant)
Adds a reactant to this reaction.- Specified by:
addReactant
in interfaceIReaction
- Overrides:
addReactant
in classReaction
- Parameters:
reactant
- Molecule added as reactant to this reaction- See Also:
Reaction.getReactants()
-
addAgent
public void addAgent(IAtomContainer agent)
Adds an agent to this reaction.- Specified by:
addAgent
in interfaceIReaction
- Overrides:
addAgent
in classReaction
- Parameters:
agent
- Molecule added as agent to this reaction- See Also:
Reaction.getAgents()
-
addReactant
public void addReactant(IAtomContainer reactant, Double coefficient)
Adds a reactant to this reaction with a stoichiometry coefficient.- Specified by:
addReactant
in interfaceIReaction
- Overrides:
addReactant
in classReaction
- Parameters:
reactant
- Molecule added as reactant to this reactioncoefficient
- Stoichiometry coefficient for this molecule- See Also:
Reaction.getReactants()
-
addProduct
public void addProduct(IAtomContainer product)
Adds a product to this reaction.- Specified by:
addProduct
in interfaceIReaction
- Overrides:
addProduct
in classReaction
- Parameters:
product
- Molecule added as product to this reaction- See Also:
Reaction.getProducts()
-
addProduct
public void addProduct(IAtomContainer product, Double coefficient)
Adds a product to this reaction.- Specified by:
addProduct
in interfaceIReaction
- Overrides:
addProduct
in classReaction
- Parameters:
product
- Molecule added as product to this reactioncoefficient
- Stoichiometry coefficient for this molecule- See Also:
Reaction.getProducts()
-
getReactantCoefficient
public Double getReactantCoefficient(IAtomContainer reactant)
Returns the stoichiometry coefficient of the given reactant.- Specified by:
getReactantCoefficient
in interfaceIReaction
- Overrides:
getReactantCoefficient
in classReaction
- Parameters:
reactant
- Reactant for which the coefficient is returned.- Returns:
- -1, if the given molecule is not a product in this Reaction
- See Also:
Reaction.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:
getProductCoefficient
in interfaceIReaction
- Overrides:
getProductCoefficient
in classReaction
- Parameters:
product
- Product for which the coefficient is returned.- Returns:
- -1, if the given molecule is not a product in this Reaction
- See Also:
Reaction.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:
setReactantCoefficient
in interfaceIReaction
- Overrides:
setReactantCoefficient
in classReaction
- 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:
Reaction.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:
setProductCoefficient
in interfaceIReaction
- Overrides:
setProductCoefficient
in classReaction
- 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:
Reaction.getProductCoefficient(org.openscience.cdk.interfaces.IAtomContainer)
-
getReactantCoefficients
public Double[] getReactantCoefficients()
Returns an array of double with the stoichiometric coefficients of the reactants.- Specified by:
getReactantCoefficients
in interfaceIReaction
- Overrides:
getReactantCoefficients
in classReaction
- Returns:
- An array of double's containing the coefficients of the reactants
- See Also:
Reaction.setReactantCoefficients(java.lang.Double[])
-
getProductCoefficients
public Double[] getProductCoefficients()
Returns an array of double with the stoichiometric coefficients of the products.- Specified by:
getProductCoefficients
in interfaceIReaction
- Overrides:
getProductCoefficients
in classReaction
- Returns:
- An array of double's containing the coefficients of the products
- See Also:
Reaction.setProductCoefficients(java.lang.Double[])
-
setReactantCoefficients
public boolean setReactantCoefficients(Double[] coefficients)
Sets the coefficients of the reactants.- Specified by:
setReactantCoefficients
in interfaceIReaction
- Overrides:
setReactantCoefficients
in classReaction
- Parameters:
coefficients
- An array of double's containing the coefficients of the reactants- Returns:
- true if coefficients have been set.
- See Also:
Reaction.getReactantCoefficients()
-
setProductCoefficients
public boolean setProductCoefficients(Double[] coefficients)
Sets the coefficient of the products.- Specified by:
setProductCoefficients
in interfaceIReaction
- Overrides:
setProductCoefficients
in classReaction
- Parameters:
coefficients
- An array of double's containing the coefficients of the products- Returns:
- true if coefficients have been set.
- See Also:
Reaction.getProductCoefficients()
-
setDirection
public void setDirection(IReaction.Direction direction)
Sets the direction of the reaction.- Specified by:
setDirection
in interfaceIReaction
- Overrides:
setDirection
in classReaction
- Parameters:
direction
- The new reaction direction- See Also:
Reaction.getDirection()
-
getDirection
public IReaction.Direction getDirection()
Returns the direction of the reaction.- Specified by:
getDirection
in interfaceIReaction
- Overrides:
getDirection
in classReaction
- Returns:
- The direction of this reaction (FORWARD, BACKWARD or BIDIRECTIONAL).
- See Also:
IReaction.Direction
,Reaction.setDirection(org.openscience.cdk.interfaces.IReaction.Direction)
-
-