Package org.openscience.cdk.silent
Class MolecularFormulaSet
- java.lang.Object
-
- org.openscience.cdk.silent.MolecularFormulaSet
-
- All Implemented Interfaces:
Cloneable
,Iterable<IMolecularFormula>
,ICDKObject
,IMolecularFormulaSet
public class MolecularFormulaSet extends Object implements Iterable<IMolecularFormula>, IMolecularFormulaSet, Cloneable
Class defining an set object of MolecularFormulas. It maintains a list of list IMolecularFormula.- Author:
- miguelrojasch
- Belongs to CDK module:
- silent
- Keywords:
- molecular formula
- Created on:
- 2007-11-20
-
-
Constructor Summary
Constructors Constructor Description MolecularFormulaSet()
Constructs an empty MolecularFormulaSet.MolecularFormulaSet(IMolecularFormula formula)
Constructs a MolecularFormulaSet with a copy MolecularFormulaSet of another MolecularFormulaSet (A shallow copy, i.e., with the same objects as in the original MolecularFormulaSet).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IMolecularFormulaSet formulaSet)
Adds all molecularFormulas in the MolecularFormulaSet to this chemObject.void
addMolecularFormula(IMolecularFormula formula)
Adds an molecularFormula to this chemObject.Object
clone()
Clones this MolecularFormulaSet object and its content.boolean
contains(IMolecularFormula formula)
True, if the MolecularFormulaSet contains the given IMolecularFormula object.IChemObjectBuilder
getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.IMolecularFormula
getMolecularFormula(int position)
Returns the MolecularFormula at positionnumber
in the chemObject.Iterator<IMolecularFormula>
iterator()
Returns an Iterator for looping over all IMolecularFormula in this MolecularFormulaSet.Iterable<IMolecularFormula>
molecularFormulas()
Returns an Iterable for looping over all IMolecularFormula in this MolecularFormulaSet.void
removeAllMolecularFormulas()
Removes all IMolecularFormula from this chemObject.void
removeMolecularFormula(int position)
Removes an MolecularFormula from this chemObject.void
removeMolecularFormula(IMolecularFormula formula)
Removes an IMolecularFormula from this chemObject.int
size()
Returns the number of MolecularFormulas in this MolecularFormulaSet.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
MolecularFormulaSet
public MolecularFormulaSet()
Constructs an empty MolecularFormulaSet.- See Also:
MolecularFormulaSet(IMolecularFormula)
-
MolecularFormulaSet
public MolecularFormulaSet(IMolecularFormula formula)
Constructs a MolecularFormulaSet with a copy MolecularFormulaSet of another MolecularFormulaSet (A shallow copy, i.e., with the same objects as in the original MolecularFormulaSet).- Parameters:
formula
- An MolecularFormula to copy from- See Also:
MolecularFormulaSet()
-
-
Method Detail
-
add
public void add(IMolecularFormulaSet formulaSet)
Adds all molecularFormulas in the MolecularFormulaSet to this chemObject.- Specified by:
add
in interfaceIMolecularFormulaSet
- Parameters:
formulaSet
- The MolecularFormulaSet
-
addMolecularFormula
public void addMolecularFormula(IMolecularFormula formula)
Adds an molecularFormula to this chemObject.- Specified by:
addMolecularFormula
in interfaceIMolecularFormulaSet
- Parameters:
formula
- The molecularFormula to be added to this chemObject
-
molecularFormulas
public Iterable<IMolecularFormula> molecularFormulas()
Returns an Iterable for looping over all IMolecularFormula in this MolecularFormulaSet.- Specified by:
molecularFormulas
in interfaceIMolecularFormulaSet
- Returns:
- An Iterable with the IMolecularFormula in this MolecularFormulaSet
- See Also:
IMolecularFormulaSet.addMolecularFormula(IMolecularFormula)
-
iterator
public Iterator<IMolecularFormula> iterator()
Returns an Iterator for looping over all IMolecularFormula in this MolecularFormulaSet.- Specified by:
iterator
in interfaceIterable<IMolecularFormula>
- Returns:
- An Iterator with the IMolecularFormula in this MolecularFormulaSet
-
size
public int size()
Returns the number of MolecularFormulas in this MolecularFormulaSet.- Specified by:
size
in interfaceIMolecularFormulaSet
- Returns:
- The number of MolecularFormulas in this MolecularFormulaSet
-
contains
public boolean contains(IMolecularFormula formula)
True, if the MolecularFormulaSet contains the given IMolecularFormula object.- Specified by:
contains
in interfaceIMolecularFormulaSet
- Parameters:
formula
- The IMolecularFormula this MolecularFormulaSet is searched for- Returns:
- True, if the MolecularFormulaSet contains the given IMolecularFormula object
-
getMolecularFormula
public IMolecularFormula getMolecularFormula(int position)
Returns the MolecularFormula at positionnumber
in the chemObject.- Specified by:
getMolecularFormula
in interfaceIMolecularFormulaSet
- Parameters:
position
- The position of the IMolecularFormula to be returned.- Returns:
- The IMolecularFormula at position
number
.
-
removeAllMolecularFormulas
public void removeAllMolecularFormulas()
Removes all IMolecularFormula from this chemObject.- Specified by:
removeAllMolecularFormulas
in interfaceIMolecularFormulaSet
-
removeMolecularFormula
public void removeMolecularFormula(IMolecularFormula formula)
Removes an IMolecularFormula from this chemObject.- Specified by:
removeMolecularFormula
in interfaceIMolecularFormulaSet
- Parameters:
formula
- The IMolecularFormula to be removed from this chemObject
-
removeMolecularFormula
public void removeMolecularFormula(int position)
Removes an MolecularFormula from this chemObject.- Specified by:
removeMolecularFormula
in interfaceIMolecularFormulaSet
- Parameters:
position
- The position of the MolecularFormula to be removed from this chemObject
-
clone
public Object clone() throws CloneNotSupportedException
Clones this MolecularFormulaSet object and its content.- Specified by:
clone
in interfaceIMolecularFormulaSet
- Overrides:
clone
in classObject
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
-
getBuilder
public IChemObjectBuilder getBuilder()
Description copied from interface:ICDKObject
Returns aIChemObjectBuilder
for the data classes that extend this class.- Specified by:
getBuilder
in interfaceICDKObject
- Returns:
- The
IChemObjectBuilder
matching thisICDKObject
-
-