Package org.openscience.cdk.silent
Class AtomContainerSet
java.lang.Object
org.openscience.cdk.silent.ChemObject
org.openscience.cdk.silent.AtomContainerSet
- All Implemented Interfaces:
Serializable
,Cloneable
,IAtomContainerSet
,ICDKObject
,IChemObject
,IChemObjectListener
public class AtomContainerSet
extends ChemObject
implements Serializable, IAtomContainerSet, IChemObjectListener, Cloneable
A set of AtomContainers.
- Author:
- hel
- See Also:
- Source code:
- main
- Belongs to CDK module:
- silent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Number of AtomContainers contained by this container.protected IAtomContainer[]
Array of AtomContainers.protected int
Amount by which the AtomContainers array grows when elements are added and the array is not large enough for that.protected Double[]
Defines the number of instances of a certain molecule in the set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Get an iterator for this AtomContainerSet.clone()
Clones this AtomContainerSet and its content.getAtomContainer
(int number) Returns the AtomContainer at positionnumber
in the container.int
Returns the number of AtomContainers in this Container.getMultiplier
(int number) Returns the multiplier for the AtomContainer at positionnumber
in the container.getMultiplier
(IAtomContainer container) Returns the multiplier of the given AtomContainer.Double[]
Returns an array of double with the stoichiometric coefficients of the products.protected void
Grows the atomContainer array by a given size.boolean
isEmpty()
Returns true if this IAtomContainerSet is empty.void
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
replaceAtomContainer
(int position, IAtomContainer container) Replace the AtomContainer at a specific position (array has to be large enough).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
sortAtomContainers
(Comparator<IAtomContainer> comparator) Sort the AtomContainers and multipliers using a provided Comparatorvoid
Called by objects to which this object has registered as a listener.toString()
Returns the String representation of this AtomContainerSet.Methods inherited from class org.openscience.cdk.silent.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
-
atomContainers
Array of AtomContainers. -
atomContainerCount
protected int atomContainerCountNumber of AtomContainers contained by this container. -
multipliers
Defines the number of instances of a certain molecule in the set. It is 1 by default. -
growArraySize
protected int growArraySizeAmount by which the AtomContainers array grows when elements are added and the array is not large enough for that.
-
-
Constructor Details
-
AtomContainerSet
public AtomContainerSet()Constructs an empty AtomContainerSet.
-
-
Method Details
-
addAtomContainer
Adds an atomContainer to this container.- Specified by:
addAtomContainer
in interfaceIAtomContainerSet
- Parameters:
atomContainer
- The atomContainer to be added to this container
-
removeAtomContainer
Removes an AtomContainer from this container.- Specified by:
removeAtomContainer
in interfaceIAtomContainerSet
- 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
-
removeAtomContainer
public void removeAtomContainer(int pos) Removes an AtomContainer from this container.- Specified by:
removeAtomContainer
in interfaceIAtomContainerSet
- Parameters:
pos
- The position of the AtomContainer to be removed from this container
-
replaceAtomContainer
Replace the AtomContainer at a specific position (array has to be large enough).- Specified by:
replaceAtomContainer
in interfaceIAtomContainerSet
- Parameters:
position
- position in array for AtomContainercontainer
- the replacement AtomContainer
-
setMultiplier
Sets the coefficient of a AtomContainer to a given value.- Specified by:
setMultiplier
in interfaceIAtomContainerSet
- 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:
-
setMultiplier
Sets the coefficient of a AtomContainer to a given value.- Specified by:
setMultiplier
in interfaceIAtomContainerSet
- 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:
-
getMultipliers
Returns an array of double with the stoichiometric coefficients of the products.- Specified by:
getMultipliers
in interfaceIAtomContainerSet
- Returns:
- The multipliers for the AtomContainer's in this set
- See Also:
-
setMultipliers
Sets the multipliers of the AtomContainers.- Specified by:
setMultipliers
in interfaceIAtomContainerSet
- Parameters:
newMultipliers
- The new multipliers for the AtomContainers in this set- Returns:
- true if multipliers have been set.
- See Also:
-
addAtomContainer
Adds an atomContainer to this container with the given multiplier.- Specified by:
addAtomContainer
in interfaceIAtomContainerSet
- Parameters:
atomContainer
- The atomContainer to be added to this containermultiplier
- The multiplier of this atomContainer
-
add
Adds all atomContainers in the AtomContainerSet to this container.- Specified by:
add
in interfaceIAtomContainerSet
- Parameters:
atomContainerSet
- The AtomContainerSet
-
atomContainers
Get an iterator for this AtomContainerSet.- Specified by:
atomContainers
in interfaceIAtomContainerSet
- Returns:
- A new Iterator for this AtomContainerSet.
-
getAtomContainer
Returns the AtomContainer at positionnumber
in the container.- Specified by:
getAtomContainer
in interfaceIAtomContainerSet
- Parameters:
number
- The position of the AtomContainer to be returned.- Returns:
- The AtomContainer at position
number
.
-
getMultiplier
Returns the multiplier for the AtomContainer at positionnumber
in the container.- Specified by:
getMultiplier
in interfaceIAtomContainerSet
- Parameters:
number
- The position of the multiplier of the AtomContainer to be returned.- Returns:
- The multiplier for the AtomContainer at position
number
. - See Also:
-
getMultiplier
Returns the multiplier of the given AtomContainer.- Specified by:
getMultiplier
in interfaceIAtomContainerSet
- 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:
-
growAtomContainerArray
protected void growAtomContainerArray()Grows the atomContainer array by a given size.- See Also:
-
getAtomContainerCount
public int getAtomContainerCount()Returns the number of AtomContainers in this Container.- Specified by:
getAtomContainerCount
in interfaceIAtomContainerSet
- Returns:
- The number of AtomContainers in this Container
-
toString
Returns the String representation of this AtomContainerSet.- Specified by:
toString
in interfaceIChemObject
- Overrides:
toString
in classObject
- Returns:
- The String representation of this AtomContainerSet
-
clone
Clones this AtomContainerSet and its content.- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classChemObject
- Returns:
- the cloned Object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
stateChanged
Called by objects to which this object has registered as a listener.- Specified by:
stateChanged
in interfaceIChemObjectListener
- Parameters:
event
- A change event pointing to the source of the change
-
sortAtomContainers
Sort the AtomContainers and multipliers using a provided Comparator- Specified by:
sortAtomContainers
in interfaceIAtomContainerSet
- Parameters:
comparator
- defines the sorting method
-
isEmpty
public boolean isEmpty()Returns true if this IAtomContainerSet is empty.- Specified by:
isEmpty
in interfaceIAtomContainerSet
- Returns:
- a boolean indicating if this ring set no atom containers
-