The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Interface NucleusCollection

All Known Subinterfaces:
IsotopicDistribution
All Known Implementing Classes:
BasicNucleusCollection

public interface NucleusCollection

An immutable group of Nuclei. Any Nucleus may be present, but null is disallowed.

NucleusCollection places the additional restriction on implementors that all methods are consistent - they can be assumed to return the same results throughout the lifetime of the NucleusCollection.

Author:
Richard Apodaca
See Also:
"Immutable Pattern (Grand98)"

Method Summary
 boolean containsNucleus(Nucleus nucleus)
          Returns true if the specified Nucleus is contained in this collection, and false otherwise.
 int countNuclei()
          Returns the number of Nuclei contained in this collection.
 Nucleus getNucleus(int index)
          Returns the isotope located at the specified zero-based index.
 int getNucleusIndex(Nucleus nucleus)
          Returns the zero-based index of the specified Nucleus.
 NucleusIterator iterateNuclei()
          Returns an iterator over all Nuclei in this collection.
 Nucleus[] toNucleusArray()
          Returns a copy of the Nuclei contained in this collection as an array.
 

Method Detail

containsNucleus

public boolean containsNucleus(Nucleus nucleus)
Returns true if the specified Nucleus is contained in this collection, and false otherwise.

Parameters:
nucleus - the Nucleus
Returns:
true if contained, false otherwise

countNuclei

public int countNuclei()
Returns the number of Nuclei contained in this collection.

Returns:
the number of Nuclei in this collection

getNucleusIndex

public int getNucleusIndex(Nucleus nucleus)
Returns the zero-based index of the specified Nucleus.

Parameters:
nucleus - the nucleus
Returns:
the index of the nucleus, or -1 if this collection does not contain nucleus

getNucleus

public Nucleus getNucleus(int index)
Returns the isotope located at the specified zero-based index.

Parameters:
index - the index
Returns:
the Nucleus at index, or null if the index is invalid
Throws:
java.lang.IndexOutOfBoundsException - if index is less than zero or greater than or equal to the number of Nuclei

iterateNuclei

public NucleusIterator iterateNuclei()
Returns an iterator over all Nuclei in this collection.

Returns:
an iterator over all Nuclei in this collection

toNucleusArray

public Nucleus[] toNucleusArray()
Returns a copy of the Nuclei contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Returns:
a copy of the Nucleus array for this collection

The Octet Molecular Representation Framework v0.8.2