public class AtomContainerSet extends ChemObject implements Serializable, IAtomContainerSet, IChemObjectListener, Cloneable
Modifier and Type | Field and Description |
---|---|
protected int |
atomContainerCount
Number of AtomContainers contained by this container.
|
protected IAtomContainer[] |
atomContainers
Array of AtomContainers.
|
protected int |
growArraySize
Amount by which the AtomContainers array grows when elements are added and
the array is not large enough for that.
|
protected Double[] |
multipliers
Defines the number of instances of a certain molecule
in the set.
|
Constructor and Description |
---|
AtomContainerSet()
Constructs an empty AtomContainerSet.
|
Modifier and Type | Method and 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.
|
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 position
number in the
container. |
int |
getAtomContainerCount()
Returns the number of AtomContainers in this Container.
|
Double |
getMultiplier(IAtomContainer container)
Returns the multiplier of the given AtomContainer.
|
Double |
getMultiplier(int number)
Returns the multiplier for the AtomContainer at position
number in the
container. |
Double[] |
getMultipliers()
Returns an array of double with the stoichiometric coefficients
of the products.
|
protected void |
growAtomContainerArray()
Grows the atomContainer array by a given size.
|
boolean |
isEmpty()
Returns true if this IAtomContainerSet is empty.
|
void |
removeAllAtomContainers()
Removes all AtomContainer from this container.
|
void |
removeAtomContainer(IAtomContainer atomContainer)
Removes an AtomContainer from this container.
|
void |
removeAtomContainer(int pos)
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).
|
boolean |
setMultiplier(IAtomContainer container,
Double multiplier)
Sets the coefficient of a AtomContainer to a given value.
|
void |
setMultiplier(int position,
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 Comparator.
|
void |
stateChanged(IChemObjectChangeEvent event)
Called by objects to which this object has
registered as a listener.
|
String |
toString()
Returns the String representation of this AtomContainerSet.
|
addListener, addProperties, compare, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopy
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty
getBuilder
protected IAtomContainer[] atomContainers
protected int atomContainerCount
protected Double[] multipliers
protected int growArraySize
public void addAtomContainer(IAtomContainer atomContainer)
addAtomContainer
in interface IAtomContainerSet
atomContainer
- The atomContainer to be added to this containerpublic void removeAtomContainer(IAtomContainer atomContainer)
removeAtomContainer
in interface IAtomContainerSet
atomContainer
- The atomContainer to be removed from this containerpublic void removeAllAtomContainers()
removeAllAtomContainers
in interface IAtomContainerSet
public void removeAtomContainer(int pos)
removeAtomContainer
in interface IAtomContainerSet
pos
- The position of the AtomContainer to be removed from this containerpublic void replaceAtomContainer(int position, IAtomContainer container)
replaceAtomContainer
in interface IAtomContainerSet
position
- position in array for AtomContainercontainer
- the replacement AtomContainerpublic boolean setMultiplier(IAtomContainer container, Double multiplier)
setMultiplier
in interface IAtomContainerSet
container
- The AtomContainer for which the multiplier is setmultiplier
- The new multiplier for the AtomContatinergetMultiplier(IAtomContainer)
public void setMultiplier(int position, Double multiplier)
setMultiplier
in interface IAtomContainerSet
position
- The position of the AtomContainer for which the multiplier is
set in [0,..]multiplier
- The new multiplier for the AtomContatiner at
position
getMultiplier(int)
public Double[] getMultipliers()
getMultipliers
in interface IAtomContainerSet
setMultipliers(java.lang.Double[])
public boolean setMultipliers(Double[] newMultipliers)
setMultipliers
in interface IAtomContainerSet
newMultipliers
- The new multipliers for the AtomContainers in this setgetMultipliers()
public void addAtomContainer(IAtomContainer atomContainer, double multiplier)
addAtomContainer
in interface IAtomContainerSet
atomContainer
- The atomContainer to be added to this containermultiplier
- The multiplier of this atomContainerpublic void add(IAtomContainerSet atomContainerSet)
add
in interface IAtomContainerSet
atomContainerSet
- The AtomContainerSetpublic Iterable<IAtomContainer> atomContainers()
atomContainers
in interface IAtomContainerSet
public IAtomContainer getAtomContainer(int number)
number
in the
container.getAtomContainer
in interface IAtomContainerSet
number
- The position of the AtomContainer to be returned.number
.public Double getMultiplier(int number)
number
in the
container.getMultiplier
in interface IAtomContainerSet
number
- The position of the multiplier of the AtomContainer to be returned.number
.setMultiplier(int, Double)
public Double getMultiplier(IAtomContainer container)
getMultiplier
in interface IAtomContainerSet
container
- The AtomContainer for which the multiplier is givensetMultiplier(IAtomContainer, Double)
protected void growAtomContainerArray()
growArraySize
public int getAtomContainerCount()
getAtomContainerCount
in interface IAtomContainerSet
public String toString()
toString
in interface IChemObject
toString
in class Object
public Object clone() throws CloneNotSupportedException
clone
in interface IChemObject
clone
in class ChemObject
CloneNotSupportedException
- if the IChemObject cannot be clonedpublic void stateChanged(IChemObjectChangeEvent event)
stateChanged
in interface IChemObjectListener
event
- A change event pointing to the source of the changepublic void sortAtomContainers(Comparator<IAtomContainer> comparator)
sortAtomContainers
in interface IAtomContainerSet
comparator
- defines the sorting methodpublic boolean isEmpty()
isEmpty
in interface IAtomContainerSet
Copyright © 2021. All rights reserved.