Package org.openscience.cdk
Class AtomContainerSet
java.lang.Object
org.openscience.cdk.ChemObject
org.openscience.cdk.AtomContainerSet
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<IAtomContainer>,IAtomContainerSet,ICDKObject,IChemObject,IChemObjectListener
- Direct Known Subclasses:
DebugAtomContainerSet,DebugSubstance,RingSet,Substance
public class AtomContainerSet
extends ChemObject
implements Serializable, IAtomContainerSet, IChemObjectListener, Cloneable
A set of AtomContainers.
- Author:
- hel
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intNumber of AtomContainers contained by this container.protected IAtomContainer[]Array of AtomContainers.protected intAmount 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.Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, MARKUSH, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IAtomContainerSet atomContainerSet) Adds all atomContainers in the AtomContainerSet to this container.voidaddAtomContainer(IAtomContainer atomContainer) Adds an atomContainer to this container.voidaddAtomContainer(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 positionnumberin the container.intReturns the number of AtomContainers in this Container.getMultiplier(int number) Returns the multiplier for the AtomContainer at positionnumberin 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 voidGrows the atomContainer array by a given size.booleanisEmpty()Returns true if this IAtomContainerSet is empty.voidRemoves all AtomContainer from this container.voidremoveAtomContainer(int pos) Removes an AtomContainer from this container.voidremoveAtomContainer(IAtomContainer atomContainer) Removes an AtomContainer from this container.voidreplaceAtomContainer(int position, IAtomContainer container) Replace the AtomContainer at a specific position (array has to be large enough).voidsetMultiplier(int position, Double multiplier) Sets the coefficient of a AtomContainer to a given value.booleansetMultiplier(IAtomContainer container, Double multiplier) Sets the coefficient of a AtomContainer to a given value.booleansetMultipliers(Double[] newMultipliers) Sets the multipliers of the AtomContainers.voidsortAtomContainers(Comparator<IAtomContainer> comparator) Sort the AtomContainers and multipliers using a provided Comparator.voidCalled 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.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, shallowCopyMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openscience.cdk.interfaces.IAtomContainerSet
iteratorMethods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilderMethods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, clear, flags, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setPropertyMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
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:
addAtomContainerin interfaceIAtomContainerSet- Parameters:
atomContainer- The atomContainer to be added to this container
-
removeAtomContainer
Removes an AtomContainer from this container.- Specified by:
removeAtomContainerin interfaceIAtomContainerSet- Parameters:
atomContainer- The atomContainer to be removed from this container
-
removeAllAtomContainers
public void removeAllAtomContainers()Removes all AtomContainer from this container.- Specified by:
removeAllAtomContainersin interfaceIAtomContainerSet
-
removeAtomContainer
public void removeAtomContainer(int pos) Removes an AtomContainer from this container.- Specified by:
removeAtomContainerin 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:
replaceAtomContainerin interfaceIAtomContainerSet- Parameters:
position- position in array for AtomContainercontainer- the replacement AtomContainer
-
setMultiplier
Sets the coefficient of a AtomContainer to a given value.- Specified by:
setMultiplierin 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:
setMultiplierin 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:
getMultipliersin interfaceIAtomContainerSet- Returns:
- The multipliers for the AtomContainer's in this set
- See Also:
-
setMultipliers
Sets the multipliers of the AtomContainers.- Specified by:
setMultipliersin 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:
addAtomContainerin 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:
addin interfaceIAtomContainerSet- Parameters:
atomContainerSet- The AtomContainerSet
-
atomContainers
Get an iterator for this AtomContainerSet.- Specified by:
atomContainersin interfaceIAtomContainerSet- Returns:
- A new Iterator for this AtomContainerSet.
-
getAtomContainer
Returns the AtomContainer at positionnumberin the container.- Specified by:
getAtomContainerin 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 positionnumberin the container.- Specified by:
getMultiplierin 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:
getMultiplierin 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:
getAtomContainerCountin interfaceIAtomContainerSet- Returns:
- The number of AtomContainers in this Container
-
toString
Returns the String representation of this AtomContainerSet.- Specified by:
toStringin interfaceIChemObject- Overrides:
toStringin classObject- Returns:
- The String representation of this AtomContainerSet
-
clone
Clones this AtomContainerSet and its content.- Specified by:
clonein interfaceIChemObject- Overrides:
clonein 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:
stateChangedin 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:
sortAtomContainersin interfaceIAtomContainerSet- Parameters:
comparator- defines the sorting method
-
isEmpty
public boolean isEmpty()Returns true if this IAtomContainerSet is empty.- Specified by:
isEmptyin interfaceIAtomContainerSet- Returns:
- a boolean indicating if this ring set no atom containers
-