Package org.openscience.cdk.debug
Class DebugAtomContainerSet
- java.lang.Object
-
- org.openscience.cdk.ChemObject
-
- org.openscience.cdk.AtomContainerSet
-
- org.openscience.cdk.debug.DebugAtomContainerSet
-
- All Implemented Interfaces:
Serializable
,Cloneable
,IAtomContainerSet
,ICDKObject
,IChemObject
,IChemObjectListener
public class DebugAtomContainerSet extends AtomContainerSet implements IAtomContainerSet
Debugging data class.- Author:
- egonw
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- datadebug
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.AtomContainerSet
atomContainerCount, atomContainers, growArraySize, multipliers
-
-
Constructor Summary
Constructors Constructor Description DebugAtomContainerSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IAtomContainerSet atomContainerSet)
Adds all atomContainers in the AtomContainerSet to this container.void
addAtomContainer(IAtomContainer atomContainer)
Adds an atomContainer to this container.void
addAtomContainer(IAtomContainer atomContainer, double multiplier)
Adds an atomContainer to this container with the given multiplier.void
addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener.void
addProperties(Map<Object,Object> properties)
Sets the properties of this object.Iterable<IAtomContainer>
atomContainers()
Get an iterator for this AtomContainerSet.Object
clone()
Clones this AtomContainerSet and its content.IAtomContainer
getAtomContainer(int number)
Returns the AtomContainer at positionnumber
in the container.int
getAtomContainerCount()
Returns the number of AtomContainers in this Container.IChemObjectBuilder
getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.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
getMultiplier(int number)
Returns the multiplier for the AtomContainer at positionnumber
in the container.Double
getMultiplier(IAtomContainer container)
Returns the multiplier of the given AtomContainer.Double[]
getMultipliers()
Returns an array of double with the stoichiometric coefficients of the products.Map<Object,Object>
getProperties()
Returns a Map with the IChemObject's properties.<T> T
getProperty(Object description)
Returns a property for the IChemObject.boolean
isEmpty()
Returns true if this IAtomContainerSet is empty.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
removeAllAtomContainers()
Removes all AtomContainer from this container.void
removeAtomContainer(int pos)
Removes an AtomContainer from this container.void
removeAtomContainer(IAtomContainer atomContainer)
Removes an AtomContainer from this container.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
replaceAtomContainer(int position, IAtomContainer container)
Replace the AtomContainer at a specific position (array has to be large enough).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.void
setMultiplier(int position, Double multiplier)
Sets the coefficient of a AtomContainer to a given value.boolean
setMultiplier(IAtomContainer container, Double multiplier)
Sets the coefficient of a AtomContainer to a given value.boolean
setMultipliers(Double[] newMultipliers)
Sets the multipliers of the AtomContainers.void
setProperty(Object description, Object property)
Sets a property for a IChemObject.-
Methods inherited from class org.openscience.cdk.AtomContainerSet
growAtomContainerArray, sortAtomContainers, stateChanged, 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.IAtomContainerSet
sortAtomContainers
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
getFlagValue, getNotification, getProperty, setNotification, setProperties, toString
-
-
-
-
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 this AtomContainerSet and its content.- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classAtomContainerSet
- 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
-
addAtomContainer
public void addAtomContainer(IAtomContainer atomContainer)
Adds an atomContainer to this container.- Specified by:
addAtomContainer
in interfaceIAtomContainerSet
- Overrides:
addAtomContainer
in classAtomContainerSet
- Parameters:
atomContainer
- The atomContainer to be added to this container
-
removeAtomContainer
public void removeAtomContainer(IAtomContainer atomContainer)
Removes an AtomContainer from this container.- Specified by:
removeAtomContainer
in interfaceIAtomContainerSet
- Overrides:
removeAtomContainer
in classAtomContainerSet
- Parameters:
atomContainer
- The atomContainer to be removed from this container
-
removeAllAtomContainers
public void removeAllAtomContainers()
Removes all AtomContainer from this container.- Specified by:
removeAllAtomContainers
in interfaceIAtomContainerSet
- Overrides:
removeAllAtomContainers
in classAtomContainerSet
-
removeAtomContainer
public void removeAtomContainer(int pos)
Removes an AtomContainer from this container.- Specified by:
removeAtomContainer
in interfaceIAtomContainerSet
- Overrides:
removeAtomContainer
in classAtomContainerSet
- Parameters:
pos
- The position of the AtomContainer to be removed from this container
-
replaceAtomContainer
public void replaceAtomContainer(int position, IAtomContainer container)
Replace the AtomContainer at a specific position (array has to be large enough).- Specified by:
replaceAtomContainer
in interfaceIAtomContainerSet
- Overrides:
replaceAtomContainer
in classAtomContainerSet
- Parameters:
position
- position in array for AtomContainercontainer
- the replacement AtomContainer
-
setMultiplier
public boolean setMultiplier(IAtomContainer container, Double multiplier)
Sets the coefficient of a AtomContainer to a given value.- Specified by:
setMultiplier
in interfaceIAtomContainerSet
- Overrides:
setMultiplier
in classAtomContainerSet
- Parameters:
container
- The AtomContainer for which the multiplier is setmultiplier
- The new multiplier for the AtomContatiner- Returns:
- true if multiplier has been set
- See Also:
AtomContainerSet.getMultiplier(IAtomContainer)
-
setMultiplier
public void setMultiplier(int position, Double multiplier)
Sets the coefficient of a AtomContainer to a given value.- Specified by:
setMultiplier
in interfaceIAtomContainerSet
- Overrides:
setMultiplier
in classAtomContainerSet
- Parameters:
position
- The position of the AtomContainer for which the multiplier is set in [0,..]multiplier
- The new multiplier for the AtomContatiner atposition
- See Also:
AtomContainerSet.getMultiplier(int)
-
getMultipliers
public Double[] getMultipliers()
Returns an array of double with the stoichiometric coefficients of the products.- Specified by:
getMultipliers
in interfaceIAtomContainerSet
- Overrides:
getMultipliers
in classAtomContainerSet
- Returns:
- The multipliers for the AtomContainer's in this set
- See Also:
AtomContainerSet.setMultipliers(java.lang.Double[])
-
setMultipliers
public boolean setMultipliers(Double[] newMultipliers)
Sets the multipliers of the AtomContainers.- Specified by:
setMultipliers
in interfaceIAtomContainerSet
- Overrides:
setMultipliers
in classAtomContainerSet
- Parameters:
newMultipliers
- The new multipliers for the AtomContainers in this set- Returns:
- true if multipliers have been set.
- See Also:
AtomContainerSet.getMultipliers()
-
addAtomContainer
public void addAtomContainer(IAtomContainer atomContainer, double multiplier)
Adds an atomContainer to this container with the given multiplier.- Specified by:
addAtomContainer
in interfaceIAtomContainerSet
- Overrides:
addAtomContainer
in classAtomContainerSet
- Parameters:
atomContainer
- The atomContainer to be added to this containermultiplier
- The multiplier of this atomContainer
-
add
public void add(IAtomContainerSet atomContainerSet)
Adds all atomContainers in the AtomContainerSet to this container.- Specified by:
add
in interfaceIAtomContainerSet
- Overrides:
add
in classAtomContainerSet
- Parameters:
atomContainerSet
- The AtomContainerSet
-
atomContainers
public Iterable<IAtomContainer> atomContainers()
Get an iterator for this AtomContainerSet.- Specified by:
atomContainers
in interfaceIAtomContainerSet
- Overrides:
atomContainers
in classAtomContainerSet
- Returns:
- A new Iterator for this AtomContainerSet.
-
getAtomContainer
public IAtomContainer getAtomContainer(int number)
Returns the AtomContainer at positionnumber
in the container.- Specified by:
getAtomContainer
in interfaceIAtomContainerSet
- Overrides:
getAtomContainer
in classAtomContainerSet
- Parameters:
number
- The position of the AtomContainer to be returned.- Returns:
- The AtomContainer at position
number
.
-
getMultiplier
public Double getMultiplier(int number)
Returns the multiplier for the AtomContainer at positionnumber
in the container.- Specified by:
getMultiplier
in interfaceIAtomContainerSet
- Overrides:
getMultiplier
in classAtomContainerSet
- Parameters:
number
- The position of the multiplier of the AtomContainer to be returned.- Returns:
- The multiplier for the AtomContainer at position
number
. - See Also:
AtomContainerSet.setMultiplier(int, Double)
-
getMultiplier
public Double getMultiplier(IAtomContainer container)
Returns the multiplier of the given AtomContainer.- Specified by:
getMultiplier
in interfaceIAtomContainerSet
- Overrides:
getMultiplier
in classAtomContainerSet
- Parameters:
container
- The AtomContainer for which the multiplier is given- Returns:
- -1, if the given molecule is not a container in this set
- See Also:
AtomContainerSet.setMultiplier(IAtomContainer, Double)
-
getAtomContainerCount
public int getAtomContainerCount()
Returns the number of AtomContainers in this Container.- Specified by:
getAtomContainerCount
in interfaceIAtomContainerSet
- Overrides:
getAtomContainerCount
in classAtomContainerSet
- Returns:
- The number of AtomContainers in this Container
-
isEmpty
public boolean isEmpty()
Returns true if this IAtomContainerSet is empty.- Specified by:
isEmpty
in interfaceIAtomContainerSet
- Overrides:
isEmpty
in classAtomContainerSet
- Returns:
- a boolean indicating if this ring set no atom containers
-
-